浏览文章
文章信息
Selenium 等待异常条件报错AttributeError: 'bytes' object has no attribute 'presence_of_element_located'
13821
#1、原因EC引用错误,个人不建议使用EC
AttributeError: 'bytes' object has no attribute 'presence_of_element_located'
EC是
from telnetlib import EC
这个是错误的包
#2、还是使用自带的引入为好
from selenium.webdriver.support import expected_conditions
# 登录 try: element = WebDriverWait(driver, 10).until( expected_conditions.presence_of_element_located((By.XPATH, '//*[@id="loginForm"]/div/div[1]/div/label/input')) ) text = driver.page_source print("text", text) finally: driver.quit()这样就可以了。