报错: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滚动条

本文针对Selenium中出现的ElementNotInteractableException错误进行了详细解析,并提供了四种实用的解决方案,包括检查元素定位、切换iframe、增加等待时间和使用JS滚动条。
1478

被折叠的 条评论
为什么被折叠?



