有两种可能
第一种
iframe标签内的标签获取不到 需要使用driver.switch_to_frame(iframe_id)来进入
第二种
是动态渲染的 你这个可class应该属于这种情况(因为UI框架的class都是有特色的 阿里蚂蚁是ant- ele-是饿了么的)
试试sleep或者等待
invisibility_of_element_located 可见
presence_of_element_located 存在
element_to_be_clickable 可点击
之类的
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions
ele = WebDriverWait(driver, 15).until(
expected_conditions.presence_of_element_located(
(By.CSS_SELECTOR, '.el-input.el-input--medium.el-input--prefix')))
试试
这代码意思是 15秒内不停的去查询元素 在其可见的时候返回
我也是以前百度学到的
