51Testing软件测试论坛
标题:
出现element not interactable怎么解决?
[打印本页]
作者:
测试积点老人
时间:
2021-8-17 11:07
标题:
出现element not interactable怎么解决?
问题如下:
# 点击被罚款部门
driver.find_element_by_xpath('//body/div[2]/div[1]/div[2]/form[1]/div[3]/div[1]/div[1]/div[1]/div[1]/input[1]').click()
sleep(2)
element = driver.find_element_by_xpath('//body/div[4]/div[1]/div[1]/ul[1]/li[3]')
sleep(1)
element.click()
driver.execute_script("arguments[0].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
打个断点,看下输出
作者:
qqq911
时间:
2021-8-18 10:55
看先元素状态吧
作者:
litingting0214
时间:
2021-8-18 17:12
看下日志 ,定位下问题
欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/)
Powered by Discuz! X3.2