Vaspandi Nallasamy
Vaspandi Nallasamy

Reputation: 13

Selenium-Python with chromium browser (windows)

I am trying to launch chromium browser with selenium python on windows 8.

Added binary_location as chromium binary location which is appdata. But still chromedriver starts google chrome instead of chromium.

If I uninstall google chrome, then chromedriver by default launches chromium. But with chrome installed it always launches chrome regardless.

Does anyone have an idea on how to start chromium with selenium while chrome installed?

Please do not mark it as duplicate. The other one was about unix and solution provided to selenium java while this one is about windows and python.

Upvotes: 1

Views: 9015

Answers (2)

undetected Selenium
undetected Selenium

Reputation: 193338

To start Chromium browser you can use the following code block :

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

options = Options()
options.binary_location("C:\\path\\to\\chrome.exe") //path to chromium binary
options.add_argument("start-maximized")
options.add_argument("--disable-gpu-vsync") //only for Windows
options.add_argument("--remote-debugging-port=9222") //for MAC & Linux
driver = webdriver.Chrome(executable_path=r'C:\path\to\chromedriver.exe', chrome_options=options)
driver.get('http://google.com/')

Note : Here you can find more details about Run Chromium with flags

Upvotes: 1

mingchau
mingchau

Reputation: 470

Try this:

from selenium.webdriver.chrome.options import Options

options = Options()
options.binary_location = r"D:\.....\chrome.exe"
# This line defines your Chromium exe file location.

driver = webdriver.Chrome(chrome_options=options)
driver.get('https://www.google.com/')

Worked for me. I installed both Chrome and Chromium. It starts the specified exe.

Upvotes: 1

Related Questions