selenium.common.exceptions.ElementNotInteractableException: Message: element not interactable

python报错:selenium.common.exceptions.ElementNotInteractableException: Message: element not interactable
1.经查不是chromdriver版本的问题

1.经查不是chromedriver版本的问题

2.代码没有问题,检查网络是否流畅

3.网络慢,页面未加载完成,元素找不到

4.解决方案,可以在访问url后面加几秒等待

例如:

driver = webdriver.Chrome()
driver.get("http://10.165.153.7")
time.sleep(5)  # 添加3s等待网页加载完成,再进行下面的元素定位
E:\pythonProject\study\venv\Scripts\python.exe "D:\Program Files\JetBrains\PyCharm 2020.3.2\plugins\python\helpers\pycharm\_jb_unittest_runner.py" --path E:/pythonProject/1890_1/common/threeweb/test_login.py
Testing started at 16:34 ...
Launching unittests with arguments python -m unittest E:/pythonProject/1890_1/common/threeweb/test_login.py in E:\pythonProject\1890_1\common\threeweb


Error
Traceback (most recent call last):
  File "D:\App\Python\Python39\lib\unittest\case.py", line 59, in testPartExecutor
    yield
  File "D:\App\Python\Python39\lib\unittest\case.py", line 593, in run
    self._callTestMethod(testMethod)
  File "D:\App\Python\Python39\lib\unittest\case.py", line 550, in _callTestMethod
    method()
  File "E:\pythonProject\1890_1\common\threeweb\test_login.py", line 21, in test_login
    driver.find_element(By.XPATH, "//input[@placeholder='请输入用户名']").send_keys("admin")
  File "E:\pythonProject\study\venv\lib\site-packages\selenium\webdriver\remote\webelement.py", line 477, in send_keys
    self._execute(Command.SEND_KEYS_TO_ELEMENT,
  File "E:\pythonProject\study\venv\lib\site-packages\selenium\webdriver\remote\webelement.py", line 633, in _execute
    return self._parent.execute(command, params)
  File "E:\pythonProject\study\venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "E:\pythonProject\study\venv\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=89.0.4389.114)




Assertion failed


Ran 1 test in 4.354s

FAILED (errors=1)

Process finished with exit code 1


Assertion failed

Assertion failed

 

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值