0

Getting the following error when trying to create object with Selenium Webdriver:

selenium.common.exceptions.NoSuchDriverException: Message: Unable to obtain chromedriver using Selenium Manager; Message: Unsuccessful command executed: Z:\Python 3.9.0\lib\site-packages\selenium\webdriver\common\windows\selenium-manager.exe --browser chrome --output json.

The same script work with one pc and get the error above with another.

The script is:

service = Service()
dimensione_finestra = 'start-maximized'
url = '...'
opzioni_chrome = webdriver.ChromeOptions()
opzioni_chrome.add_argument(dimensione_finestra)
driver = webdriver.Chrome(service=service, options=opzioni_chrome)
driver.get(url)

Any idea?

Simone
  • 1
  • 1

1 Answers1

0

You may try using the Service() class along with ChromeDriverManager().install()

from selenium.webdriver import Chrome, ChromeOptions
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.chrome.service import Service

options = ChromeOptions()
options.add_argument("--start-maximized")

driver = Chrome(service=Service(ChromeDriverManager().install()), options=options)
driver.get("Url")

and you'll need to install

pip install selenium
pip install webdriver-manager

reference:

Ajeet Verma
  • 2,938
  • 3
  • 13
  • 24