错误说明了一切:
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_clickable为WebElement 与特定 页码 (例如 , , ,等)是 如下:
webdriverwait(self.driver, 30).until(EC.element_to_be_clickable((By.XPATH, "//a[contains(text(),'3')]"))).click()