Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 16536

AttributeError: 'str' object has no attribute 'capabilities' while executing python script

$
0
0

I'm new to Python coding. I just finished installing Python, Pycharm, Selenium and configured Driver manager.

And when I run my first program I'm seeing below error message. Code attached below. Please help. Thanks.

Please go through attached image.

And the error I'm seeing is:

"C:\Program Files\Python312\python.exe" C:\Users\...\...\BOFA.py Traceback (most recent call last):  File "C:\Users\...\AppData\Roaming\Python\Python312\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\...\AppData\Roaming\Python\Python312\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\...\...\Desktop\...\BOFA.py", line 5, in <module>    driver = webdriver.Chrome(ChromeDriverManager().install())             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  File "C:\Users\...\AppData\Roaming\Python\Python312\site-packages\selenium\webdriver\chrome\webdriver.py", line 45, in __init__    super().__init__(  File "C:\Users\vtadu\AppData\Roaming\Python\Python312\site-packages\selenium\webdriver\chromium\webdriver.py", line 49, in __init__    self.service.path = DriverFinder.get_path(self.service, options)                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  File "C:\Users\...\AppData\Roaming\Python\Python312\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

And I looked into some of the suggestions provided, it says it's Python issue because it's reading as None. But not sure how to come out of this scenario. Really appreciate any suggestions. Thanks.


Viewing all articles
Browse latest Browse all 16536

Trending Articles