So I have installed python3.8, selenium 4.16 and chromedriver on my web server with root ssh access. I can run chromedriver in terminal, looking good.When I try a simple python script it crashes with error:
Traceback (most recent call last): File "/usr/local/lib/python3.8/dist-packages/selenium-4.16.0-py3.8.egg/selenium/webdriver/common/driver_finder.py", line 38, in get_path path = SeleniumManager().driver_location(options) if path is None else path File "/usr/local/lib/python3.8/dist-packages/selenium-4.16.0-py3.8.egg/selenium/webdriver/common/selenium_manager.py", line 84, 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 "sel.py", line 7, in <module> driver = webdriver.Chrome('chromedriver') File "/usr/local/lib/python3.8/dist-packages/selenium-4.16.0-py3.8.egg/selenium/webdriver/chrome/webdriver.py", line 45, in __init__ super().__init__( File "/usr/local/lib/python3.8/dist-packages/selenium-4.16.0-py3.8.egg/selenium/webdriver/chromium/webdriver.py", line 49, in __init__ self.service.path = DriverFinder.get_path(self.service, options) File "/usr/local/lib/python3.8/dist-packages/selenium-4.16.0-py3.8.egg/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'
I have tried this very basic test script:
#! /usr/bin/python3.8from selenium import webdriverfrom selenium.webdriver.common.keys import Keysdriver = webdriver.Chrome('chromedriver')driver.get("https://www.python.org")print(driver.title)
It looks like it cannot find something, tries to check "capabilities" but they obviously don't exist for something "unknown". Instead of checking for type and existance of appropriate item, it throws a message which doesn't help – I consider this very bad programming. Anyway - does anyone have an idea what this is?Any help is appreciated.