[Python] selenium.common.exceptions.NoSuchDriverException: Message: Unable to obtain...

Discussão em 'Python' iniciado por Stack, Junho 23, 2025.

  1. Stack

    Stack Membro Participativo

    I can't figure out why my code it's always getting an error

    This is my code:

    from selenium import webdriver

    url = "https://google.com/"
    path = "C:/Users/thefo/OneDrive/Desktop/summer 2023/chromedriver_win32"

    driver = webdriver.Chrome(path)
    driver.get(url)


    Path of chromedriver:

    [​IMG]

    and this is the error that always appears:

    Traceback (most recent call last):
    File "C:\Users\thefo\AppData\Local\Programs\Python\Python311\Lib\site-packages\selenium\webdriver\common\driver_finder.py", line 42, in get_path
    path = SeleniumManager().driver_location(options) if path is None else path
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "C:\Users\thefo\AppData\Local\Programs\Python\Python311\Lib\site-packages\selenium\webdriver\common\selenium_manager.py", line 74, in driver_location
    browser = options.capabilities["browserName"]
    ^^^^^^^^^^^^^^^^^^^^
    AttributeError: 'str' object has no attribute 'capabilities'

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
    File "c:\Users\thefo\OneDrive\Desktop\summer 2023\Projeto Bot Discord - BUFF SELL CHECKER\teste2.py", line 6, in <module>
    driver = webdriver.Chrome(path)
    ^^^^^^^^^^^^^^^^^^^^^^
    File "C:\Users\thefo\AppData\Local\Programs\Python\Python311\Lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 47, in __init__
    self.service.path = DriverFinder.get_path(self.service, self.options)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "C:\Users\thefo\AppData\Local\Programs\Python\Python311\Lib\site-packages\selenium\webdriver\common\driver_finder.py", line 44, in get_path
    raise NoSuchDriverException(f"Unable to obtain {service.path} using Selenium Manager; {err}")
    selenium.common.exceptions.NoSuchDriverException: Message: Unable to obtain chromedriver using Selenium Manager; 'str' object has no attribute 'capabilities'; For documentation on this error, please visit: https://www.selenium.dev/documentation/webdriver/troubleshooting/errors/driver_location

    Continue reading...

Compartilhe esta Página