Use Selenium with Chromium Browser

我的梦境 提交于 2019-11-28 08:20:27

yes. for chrome use

DefaultSelenium selenium = new DefaultSelenium("localhost", 4444, "*custom path/to/chromium" , "www.google.com");
selenium.start();

The other options that you can use are *custom, *chrome(note: this is not Google chrome, its a firefox mode only), *googlechrome, *iexplore. Please check selenium documentation for complete list of the modes.

EDIT: Changed googlechrome to chromium

Uh, the accepted answer doesn't answer the question. Google Chrome is based on Chromium, but they're not the same browser.

This is what you want: (since Chromium isn't officially supported)

DefaultSelenium selenium = new DefaultSelenium("localhost", 4444, "*custom C:/path/to/chromium.exe" , "www.google.com");
selenium.start();

Edit 2018-08: Looks like the accepted answer changed to a copy of this one several years later, so my original comment is no longer correct. I'm leaving it there, but struck out, because the votes are misleading if I straight remove it.

On unix systems, you can do something like

sudo ln -s /usr/lib/chromium-browser/chromium-browser /usr/bin/google-chrome

and then you can use "*googlechrome" as the lauch parm when creating your DefaultSelenium instance.

It's probably too easy, and I'm going to figure out what I did that is horribly wrong, but...

    ChromeOptions options = new ChromeOptions();

    options.BinaryLocation = "C:\Program Files (x86)\Chromium\Application\chrome.exe");

    using (var chrome = new ChromeDriver(options))

appears to work...

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!