webdriver error while working with selenium with python

33 views Asked by At

I am getting this error

C:\Users\Admin\PycharmProjects\Testing\.venv\Scripts\python.exe C:\Users\Admin\PycharmProjects\Testing\firsttest.py 
Traceback (most recent call last):
  File "C:\Users\Admin\PycharmProjects\Testing\.venv\Lib\site-packages\selenium\webdriver\common\driver_finder.py", line 38, in get_path
    path = SeleniumManager().driver_location(options) if path is None else path
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Admin\PycharmProjects\Testing\.venv\Lib\site-packages\selenium\webdriver\common\selenium_manager.py", line 87, 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\Admin\PycharmProjects\Testing\firsttest.py", line 2, in <module>
    driver = webdriver.Chrome('C:\\BrowserDriver\\chromedriver.exe')
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Admin\PycharmProjects\Testing\.venv\Lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 45, in __init__
    super().__init__(
  File "C:\Users\Admin\PycharmProjects\Testing\.venv\Lib\site-packages\selenium\webdriver\chromium\webdriver.py", line 49, in __init__
    self.service.path = DriverFinder.get_path(self.service, options)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Admin\PycharmProjects\Testing\.venv\Lib\site-packages\selenium\webdriver\common\driver_finder.py", line 40, in get_path
    msg = f"Unable to obtain driver for {options.capabilities['browserName']} using Selenium Manager."
                                         ^^^^^^^^^^^^^^^^^^^^
AttributeError: 'str' object has no attribute 'capabilities'

Process finished with exit code 1

how to resolve this error, and open chrome Brower by web driver

0

There are 0 answers