Home > Enterprise >  Selenium Service ignoring executable_path?
Selenium Service ignoring executable_path?

Time:05-26

So I'm on Selenium 4.1.5, and when I try to run:

from selenium import webdriver
from selenium.webdriver.chrome.service import Service

service = Service(executable_path=f'./chromedriver.exe')
driver = webdriver.Chrome(service=service)

I get

Message: session not created: This version of ChromeDriver only supports Chrome version 100 Current browser version is 102.0.5005.63 with binary path C:\Program Files\Google\Chrome\Application\chrome.exe

Thing is, I haven't changed anything in the directory and it's been running peachy-keen up until today randomly. I can manually open chromedriver and see it's v100, so my guess is executable_path is being ignored? I've also tried the deprecated non-service inline path setting to no avail. Hoping someone could point me in the right direction.

CodePudding user response:

One option is to use chromedriver-autoinstaller to do it all at once:

import chromedriver_autoinstaller as chromedriver
chromedriver.install()

Alternatively use chromedriver-binary-auto to find the required version and install the driver:

pip install --upgrade --force-reinstall chromedriver-binary-auto
import chromedriver_binary

OR

Update the chrome version using the link and reboot

  • Related