Search code examples
pythonseleniumwebdrivergeckodriver

Python Selenium Webdriver Error on Windows


I need some help with the geckodriver. I have installed it on Environment Path on Windows, but still i got this error and i really don't know what to do to fix it.

  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'

The user is running Windows 10.

Thank you, I


Solution

  • According to this answer only reinstalling is the way.

    it quotes

    Incase the getAttribute.js file doesn't gets downloaded properly Selenium and webdriver modules may not work properly. The issue can arise if the Selenium Client encounters any error during its transmission or storage.

    Selenium Team is currently working on the issue SeleniumHQ/selenium/5378 to generate the binary checksum of the Downloaded Selenium Client which will help you to avoid encountering errors which may have been introduced during its transmission or storage.

    Try first uninstalling:

    pip uninstall selenium

    Then install it again:

    pip install selenium --upgrade