Selenium報:selenium.common.exceptions.ElementNotInteractableException: Message: element not interactable的解決方法


最近用selenium+python寫代碼新建了一個文件夾

在文件夾中書寫.py文件時代碼在同事電腦上走通沒有問題

自己電腦經常報:selenium.common.exceptions.ElementNotInteractableException: Message: element not interactable

報錯如下:

C:\Users\EDZ\Desktop\selenium_demo\venv\Scripts\python.exe C:/Users/EDZ/Desktop/selenium_demo/webdriver/Alret.py
Traceback (most recent call last):
  File "C:/Users/EDZ/Desktop/selenium_demo/webdriver/Alret.py", line 26, in <module>
    driver.find_element_by_class_name('setpref').click() #通過class定位到搜索升設置
  File "C:\Users\EDZ\Desktop\selenium_demo\venv\lib\site-packages\selenium\webdriver\remote\webelement.py", line 80, in click
    self._execute(Command.CLICK_ELEMENT)
  File "C:\Users\EDZ\Desktop\selenium_demo\venv\lib\site-packages\selenium\webdriver\remote\webelement.py", line 672, in _execute
    return self._parent.execute(command, params)
  File "C:\Users\EDZ\Desktop\selenium_demo\venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 318, in execute
    self.error_handler.check_response(response)
  File "C:\Users\EDZ\Desktop\selenium_demo\venv\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 240, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.ElementNotInteractableException: Message: element not interactable
  (Session info: chrome=84.0.4147.105)
Stacktrace:
Backtrace:
    Ordinal0 [0x01189563+2725219]
    Ordinal0 [0x01088551+1672529]
    Ordinal0 [0x00F70202+524802]
    Ordinal0 [0x00F0A0BA+106682]
    Ordinal0 [0x00F043B1+82865]
    Ordinal0 [0x00F1AA9D+174749]
    Ordinal0 [0x00F041F6+82422]
    Ordinal0 [0x00F1ACE1+175329]
    Ordinal0 [0x00F23D7C+212348]
    Ordinal0 [0x00F1A94B+174411]
    Ordinal0 [0x00F02528+75048]
    Ordinal0 [0x00F035A0+79264]
    Ordinal0 [0x00F03539+79161]
    Ordinal0 [0x0109D607+1758727]
    GetHandleVerifier [0x012A6546+1050150]
    GetHandleVerifier [0x012A6291+1049457]
    GetHandleVerifier [0x012B10D7+1094071]
    GetHandleVerifier [0x012A6B46+1051686]
    Ordinal0 [0x01095B06+1727238]
    Ordinal0 [0x0109EB7B+1764219]
    Ordinal0 [0x0109ECE3+1764579]
    Ordinal0 [0x010B4C05+1854469]
    BaseThreadInitThunk [0x777C6359+25]
    RtlGetAppContainerNamedObjectPath [0x77B67C24+228]
    RtlGetAppContainerNamedObjectPath [0x77B67BF4+180]

通過大佬指點,應該是鏈接超時問題

解決方法,為了保證程序和鏈接的穩定性,在.py所在的文件夾中上傳chromedriver文件

如下圖:

 

 重新執行代碼就不報錯了!

 

 

以上如果有問題隨時溝通。

感謝!


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM