最近用selenium+python写代码新建了一个文件夹
在文件夹中书写.py文件时代码在同事电脑上走通没有问题
自己电脑经常报:selenium.common.exceptions.ElementNotInteractableException: Message: element not interactable
报错如下:
C:UsersEDZDesktopselenium_demovenvScriptspython.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:UsersEDZDesktopselenium_demovenvlibsite-packagesseleniumwebdriver emotewebelement.py", line 80, in click self._execute(Command.CLICK_ELEMENT) File "C:UsersEDZDesktopselenium_demovenvlibsite-packagesseleniumwebdriver emotewebelement.py", line 672, in _execute return self._parent.execute(command, params) File "C:UsersEDZDesktopselenium_demovenvlibsite-packagesseleniumwebdriver emotewebdriver.py", line 318, in execute self.error_handler.check_response(response) File "C:UsersEDZDesktopselenium_demovenvlibsite-packagesseleniumwebdriver emoteerrorhandler.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文件
如下图:
重新执行代码就不报错了!
以上如果有问题随时沟通。
感谢!