1

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.

  • Possible duplicate of [Selenium use Chromium instead of google-chrome](https://stackoverflow.com/questions/24999318/selenium-use-chromium-instead-of-google-chrome) – nj2237 Mar 15 '18 at 11:34

2 Answers2

1

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.

mingchau
  • 450
  • 3
  • 12
  • Do you have google chrome installed on your machine? Because this doesn't works for me if i install chrome parallely. It launches chrome instead. – Vaspandi Nallasamy Mar 15 '18 at 11:58
  • @VaspandiNallasamy Yes, I have both installed. Chrome in: "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe", Chromium in "C:\Users\mingchau\AppData\Local\Chromium\Application\chrome.exe" – mingchau Mar 15 '18 at 11:59
  • Found the culprit, latest chromedriver was the issue. Tested with chromedriver 2.36 and chromium 65 working fine. Accepting your answer. – Vaspandi Nallasamy Mar 16 '18 at 04:50
  • @VaspandiNallasamy why did you accept an answer that is completely unrelated to how you solved your issue? – Corey Goldberg May 07 '18 at 12:58
  • chrome_options key is a deprecated argument for options, as by [doc](https://selenium-python.readthedocs.io/api.html#selenium.webdriver.chrome.webdriver.WebDriver.__init__). Use **desired_capabilities** instead – woodz Mar 04 '19 at 22:01
1

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

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352