测试积点老人 发表于 2021-8-17 11:07:01

出现element not interactable怎么解决?

问题如下:
# 点击被罚款部门
driver.find_element_by_xpath('//body/div/div/div/form/div/div/div/div/div/input').click()
sleep(2)
element = driver.find_element_by_xpath('//body/div/div/div/ul/li')
sleep(1)
element.click()
driver.execute_script("arguments.click();", element)定位没有问题,但是一直报element not interactable怎么解决?
报错如下:
Traceback (most recent call last):
File "C:/xianyikun/shuangchongyufang/cesi.py", line 39, in <module>
    element.click()
File "C:\Python38\lib\site-packages\selenium\webdriver\remote\webelement.py", line 80, in click
    self._execute(Command.CLICK_ELEMENT)
File "C:\Python38\lib\site-packages\selenium\webdriver\remote\webelement.py", line 633, in _execute
    return self._parent.execute(command, params)
File "C:\Python38\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
File "C:\Python38\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.ElementNotInteractableException: Message: element not interactable
(Session info: chrome=92.0.4515.131)

Process finished with exit code 1

bellas 发表于 2021-8-18 09:26:08

打个断点,看下输出

qqq911 发表于 2021-8-18 10:55:38

看先元素状态吧

litingting0214 发表于 2021-8-18 17:12:17

看下日志 ,定位下问题
页: [1]
查看完整版本: 出现element not interactable怎么解决?