Home > Mobile >  Python Selenium Beta Chrome driver uses wrong binary path
Python Selenium Beta Chrome driver uses wrong binary path

Time:07-01

I'm currently switching from chrome 102 to 104 Beta (since 103 has an unfixed error for my use case with a python - selenium script)

I installed the Chrome Beta 104 the 104 chrome driver. When I start up the script it recognizes that it's a 104 driver but the driver itself searches for the chrome.exe application within the old chrome path:

Where it searches right now: C:\Program Files\Google\Chrome\Application\chrome.exe

Where it should search for: C:\Program Files\Google\Chrome Beta\Application\chrome.exe

Is there some simple way of changing the binary path where the beta chrome driver searches for the exe? Something simple I could put within my python script would be lovely.

CodePudding user response:

In that case, you should specify where selenium has to look to find your chrome executer with binary_location inside the Options class.

Try this one out:

Assuming your chromedriver.exe and python file are on the same folder, otherwise you'll have to specify the path of the chromedriver.exe as well.

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

options = Options()
options.binary_location = r'C:\Program Files\Google\Chrome Beta\Application\chrome.exe'
browser = webdriver.Chrome(options = options, service = Service("chromedriver.exe"))

browser.get(your_url)
  • Related