Web自动化——Selenium中ElementNotInteractableException

报错:selenium.common.exceptions.ElementNotInteractableException: Message: Element ···· could not be scrolled into view。
就是当前元素不可进行交互。

解决办法:
(1)检查元素定位是否正确,可以通过id,xpath,css等多种方式。

(2)查看是否需要切换iframe,切换到元素对应的iframe标签下

driver.switch_to.frame(driver.find_element_by_xpath()

(3)是否需要增加等待时间

from time import sleep

sleep(5)

(4)是否需要用js的方法来scroll滚动条


版权声明:本文为for_further原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。