这个问题在这里已有答案:
我需要一些geckodriver的帮助。我已经在Windows上安装了环境路径,但我仍然遇到此错误,我真的不知道该怎么做才能修复它。
File "Raport_FR_CH_Nata.py", line 1, in <module>
from selenium import webdriver
File "C:\Users\cursu\AppData\Local\Programs\Python\Python37-32\lib\site-packages\selenium-3.141.0-py3.7.egg\selenium\webdriver\__init__.py", line 18, in <module>
from .firefox.webdriver import WebDriver as Firefox # noqa
File "C:\Users\cursu\AppData\Local\Programs\Python\Python37-32\lib\site-packages\selenium-3.141.0-py3.7.egg\selenium\webdriver\firefox\webdriver.py", line 26, in <module>
from selenium.webdriver.remote.webdriver import WebDriver as RemoteWebDriver
File "C:\Users\cursu\AppData\Local\Programs\Python\Python37-32\lib\site-packages\selenium-3.141.0-py3.7.egg\selenium\webdriver\remote\webdriver.py", line 26, in <module>
from .webelement import WebElement
File "C:\Users\cursu\AppData\Local\Programs\Python\Python37-32\lib\site-packages\selenium-3.141.0-py3.7.egg\selenium\webdriver\remote\webelement.py", line 43, in <module>
getAttribute_js = pkgutil.get_data(_pkg, 'getAttribute.js').decode('utf8')
File "C:\Users\cursu\AppData\Local\Programs\Python\Python37-32\lib\pkgutil.py", line 637, in get_data
return loader.get_data(resource_name)
File "<frozen importlib._bootstrap_external>", line 916, in get_data
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\cursu\\AppData\\Local\\Programs\\Python\\Python37-32\\lib\\site-packages\\selenium-3.141.0-py3.7.egg\\selenium\\webdriver\\remote\\getAttribute.js'
用户正在运行Windows 10。
谢谢你
根据this的回答,只有重新安装就是这样。
它引用了
如果没有正确下载getAttribute.js文件,Selenium和webdriver模块可能无法正常工作。如果Selenium客户端在传输或存储期间遇到任何错误,则可能会出现此问题。
Selenium团队目前正在研究SeleniumHQ/selenium/5378问题,以生成Downloaded Selenium Client的二进制校验和,这将帮助您避免遇到可能在传输或存储期间引入的错误。
首先尝试卸载:
pip uninstall selenium
然后再次安装:
pip install selenium --upgrade