【发布时间】:2017-03-23 09:05:05
【问题描述】:
我制作了搜索我感兴趣的字符串集的脚本,但我有错误。 我如何解决以下问题:
links = driver.find_elements_by_xpath("xpath")
for x in range(0, len(links)):
driver.implicitly_wait(2)
links[x].click()
try:
driver.implicitly_wait(3)
DO something
driver.back()
print("Mission completed!!")
except (ElementNotVisibleException, NoSuchElementException):
driver.back()
print("No action")
Error:
selenium.common.exceptions.StaleElementReferenceException: Message: The element reference is stale. Either the element is no longer attached to the DOM or the page has been refreshed.
in line: links[x].click()
【问题讨论】:
标签: python python-2.7 selenium selenium-webdriver