Use Selenium with Chromium Browser

2019-01-23 14:35发布

In the Selenium options (on Firefox) I can find Custom browser.

Is it possible to use this option to run a Selenium test in Chromium Browser (not Chrome)?

3条回答
冷血范
2楼-- · 2019-01-23 14:41

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.

查看更多
ゆ 、 Hurt°
3楼-- · 2019-01-23 14:58

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.

查看更多
Bombasti
4楼-- · 2019-01-23 15:02

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

查看更多
登录 后发表回答