Selenium & Python:按钮不可交互;href= "javascript:void(0);"点击属性



我正在尝试点击这个按钮

下一页>>

我的代码是
next_page = driver.find_element_by_xpath("//a[contains(text(), 'Next')]")
next_page.click()

我也试过使用类名和onclick属性名,但它们也不工作。

代码返回错误为ElementNotInteractableException: Message: element not interactable (Session info: chrome=88.0.4324.192)。

按钮可能是隐藏的,不能直接访问。也许可以试试这个:

from selenium.webdriver.common.action_chains import ActionChains
next_page = driver.find_element_by_xpath("//a[contains(text(), 'Next')]")
driver.implicitly_wait(10)
ActionChains(driver).move_to_element(next_page).click(next_page).perform()

如何修复"元素不可交互"的问题例外吗?

最新更新