您好, 欢迎来到 !    登录 | 注册 | | 设为首页 | 收藏本站

Selenium单击一次,但下一步单击将返回StaleElementReferenceException

Selenium单击一次,但下一步单击将返回StaleElementReferenceException

错误说明了一切:

selenium.common.exceptions.StaleElementReferenceException: Message: stale element reference: element is not attached to the page document

for()循环内的程序中,您将在页面上找到<a>文本标记 ***

一种令人信服的迭代页面方法是:

driver.find_element_by_xpath("//a[contains(text(),'>>')]").click()

可以诱导WebDriverWait在-结合expected_conditions子句设置为element_to_be_clickableWebElement 与特定 页码 (例如 , , ,等)是 如下:

webdriverwait(self.driver, 30).until(EC.element_to_be_clickable((By.XPATH, "//a[contains(text(),'3')]"))).click()
其他 2022/1/1 18:29:13 有446人围观

撰写回答


你尚未登录,登录后可以

和开发者交流问题的细节

关注并接收问题和回答的更新提醒

参与内容的编辑和改进,让解决方法与时俱进

请先登录

推荐问题


联系我
置顶