【问题标题】:Python Selenium Webdriver Error on Windows [duplicate]Windows上的Python Selenium Webdriver错误[重复]
【发布时间】:2019-03-19 13:01:17
【问题描述】:

我需要一些有关壁虎驱动程序的帮助。我已经将它安装在 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。

谢谢你, 我

【问题讨论】:

    标签: python selenium webdriver geckodriver


    【解决方案1】:

    根据this的回答,只有重新安装才是正确的方法。

    引用

    如果 getAttribute.js 文件没有正确下载 Selenium 和 webdriver 模块可能无法正常工作。该问题可以 如果 Selenium 客户端在其执行过程中遇到任何错误,则会出现 传输或存储。

    Selenium 团队目前正在解决这个问题 SeleniumHQ/selenium/5378 生成二进制校验和 下载的 Selenium 客户端将帮助您避免遇到 在传输过程中可能引入的错误或 存储。

    先卸载试试:

    pip uninstall selenium

    然后重新安装:

    pip install selenium --upgrade

    【讨论】:

    • 谢谢!我直接安装 python 模块,而不是通过 pip 和 python setup.py install。我有一个强大的防火墙,无法使用 pip,因为所有端口都已关闭...谢谢!
    • 嗨,我已经从这里安装了它github.com/SeleniumHQ/Selenium。下载 zip,解压缩并使用 python setup.py install 从 py 文件夹安装它。当我从这里重新安装 selenium-Windows 版本时,您可以关闭票证,一切都很好! pypi.org/project/selenium/#files 好像安装坏了。谢谢!
    • @Cohen 这里没有票。但是您可以将我的答案标记为已接受,将其称为closed with satisfactory answer
    猜你喜欢
    • 2017-05-18
    • 1970-01-01
    • 2017-04-11
    • 2018-01-20
    • 2017-07-17
    • 2022-01-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多