我在Selenium中遇到此错误:
〜\ Anaconda3 \ lib \ site-packages \ selenium \ webdriver \ support \ wait.py在>直到(自己,方法,消息) 78如果time.time()> end_time: 79休息 ---> 80引发TimeoutException(消息,屏幕,堆栈跟踪) 81 82 def until_not(self,method,message =''):
TimeoutException:消息:
下面是我正在使用的代码。有人能指出我正确的方向吗?我希望代码访问列表中的下一个项目,并最终尝试执行该try块。
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.common.exceptions import NoSuchElementException
items =['page1', 'page2']
for item in test_list:
driver.get("https://www.example.com/" + item)
try:
WebDriverWait(driver, 150).until(EC.visibility_of_element_located((By.ID, 'windowConfirmAutomatch')))
save_suggested_matches_button = driver.find_element_by_link_text('Save Suggested Matches')
driver.execute_script("arguments[0].click();", save_suggested_matches_button)
WebDriverWait(driver, 150).until(EC.invisibility_of_element_located((By.ID, 'windowConfirmAutomatch')))
print("AutoMatch Complete for " + item)
except NoSuchElementException:
continue