Skip to content

[🐛 Bug]: Python Selenium 4.12.0 cannot create Chromium driver on raspberry Pi/PiOS "AttributeError: 'str' object has no attribute 'capabilities'" #12746

@CalebKierum

Description

@CalebKierum

What happened?

When trying to get Chromium going with selenium I constantly get the following error

chromedriver
Traceback (most recent call last):
  File "/home/admin/.local/lib/python3.9/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 "/home/admin/.local/lib/python3.9/site-packages/selenium/webdriver/common/selenium_manager.py", line 76, in driver_location
    browser = options.capabilities["browserName"]
AttributeError: 'str' object has no attribute 'capabilities'

How I have tried getting it

print(webdriver.Chrome())
print(webdriver.Chrome("/usr/bin/chromedriver"))
print(webdriver.Chrome('/usr/lib/chromium-browser/chromedriver'))

Browser version

chromium-browser --version
Chromium 113.0.5672.95 Built on Raspbian , running on Raspbian 11

Webdriver version

sudo apt install chromium-chromedriver
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
chromium-chromedriver is already the newest version (113.0.5672.95-rpt1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Chromedriver
chromedriver --version
ChromeDriver <Some IP> (917deeefba48411c7b40ba19aef7b229bf48acd7-refs/branch-heads/5672_63@{#13})
which chromedriver
/usr/bin/chromedriver
Where is the driver
dpkg -L chromium-chromedriver
/.
/usr
/usr/bin
/usr/bin/chromedriver
/usr/lib
/usr/lib/chromium-browser
/usr/share
/usr/share/doc
/usr/share/doc/chromium-chromedriver
/usr/share/doc/chromium-chromedriver/changelog.Debian.gz
/usr/share/doc/chromium-chromedriver/copyright
/usr/lib/chromium-browser/chromedriver

Selenium

Type "help", "copyright", "credits" or "license" for more information.
>>> import selenium
>>> selenium.__version__
'4.12.0'

Yet as you can see I have the chromium browser, I have the chromium driver, their versions match. Why isn't this working well? What does this error mean?

I have tried reading other posts to figure this one out but most of them seemed to have the issue that the driver version did not match. This is not the case here. Furthermore in the documentation for selenium it says that in version 4.6 or higher it should automatically download drivers.
What might be going on here?

How can we reproduce the issue?

Set up a raspberryPi running RaspberryPiOS

sudo apt-get install chromium-browser
sudo apt install chromium-chromedriver

Then in python try running any of the following
print(webdriver.Chrome())
print(webdriver.Chrome("/usr/bin/chromedriver"))
print(webdriver.Chrome('/usr/lib/chromium-browser/chromedriver'))

Notice them not working

Relevant log output

chromedriver
Traceback (most recent call last):
  File "/home/admin/.local/lib/python3.9/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 "/home/admin/.local/lib/python3.9/site-packages/selenium/webdriver/common/selenium_manager.py", line 76, in driver_location
    browser = options.capabilities["browserName"]
AttributeError: 'str' object has no attribute 'capabilities'

Operating System

PiOS

Selenium version

4.12.0

What are the browser(s) and version(s) where you see this issue?

Chromium 113.0.5672.95 Built on Raspbian , running on Raspbian 11

What are the browser driver(s) and version(s) where you see this issue?

113.0.5672.95-rpt1) ChromeDriver (917deeefba48411c7b40ba19aef7b229bf48acd7-refs/branch-heads/5672_63@{#13})

Are you using Selenium Grid?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-needs-triagingA Selenium member will evaluate this soon!I-defectSomething is not working as intended

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions