[Python] I am trying to webscrape with selenium, but when I run my code, webdriver gives me a...

Discussão em 'Python' iniciado por Stack, Dezembro 22, 2024.

  1. Stack

    Stack Membro Participativo

    Everytime I run this code on any device (I tried on my Mac and Windows)

    from selenium import webdriver

    PATH="/Users/priyanshulal/Library/Mobile Documents/com~apple~CloudDocs/chromedriver-mac-arm64"
    driver = webdriver.Chrome(PATH)

    driver.get("https://www.chess.com/")

    driver.close()


    it gives me the same error:

    Traceback (most recent call last):
    File "/Users/priyanshulal/Library/Mobile Documents/com~apple~CloudDocs/PersonalProject/selen/selen.py", line 4, in <module>
    driver = webdriver.Chrome(PATH)
    ^^^^^^^^^^^^^^^^^^^^^^
    File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/selenium/webdriver/chrome/webdriver.py", line 45, in __init__
    super().__init__(
    File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/selenium/webdriver/chromium/webdriver.py", line 50, in __init__
    if finder.get_browser_path():
    ^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/selenium/webdriver/common/driver_finder.py", line 47, in get_browser_path
    return self._binary_paths()["browser_path"]
    ^^^^^^^^^^^^^^^^^^^^
    File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/selenium/webdriver/common/driver_finder.py", line 56, in _binary_paths
    browser = self._options.capabilities["browserName"]
    ^^^^^^^^^^^^^^^^^^^^^^^^^^


    I am new to coding, so I'm not exactly sure what went wrong.

    I expected a window for Chess.com with Google Chrome to pop up then close, but I got an error instead.

    Continue reading...

Compartilhe esta Página