Selenium使用Chromium而不是谷歌浏览器 [英] Selenium use Chromium instead of google-chrome
问题描述
我首先安装了Chromium并准备好了我的Selenium测试以运行它(我有chromeDriver,并且创建了指向铬浏览器的符号链接google-chrome)。一切顺利。
I first installed Chromium and prepared my Selenium tests to run with it (I have the chromeDriver and I did create the symbolic link google-chrome pointing to chromium-browser). Everything was running smooth.
后来我安装了google-chrome浏览器来调试一些node.js应用程序,此后Selenium打开Google Chrome而不是Chromium。
Later I did install the google-chrome browser to debug some node.js application and since then Selenium opens Google Chrome instead of Chromium.
我不知道如何找回硒开放铬。
Synobolic链接确实存在,并指向铬浏览器。
I can not figure out how to get back selenium opening Chromium. The synmbolic link does exist and points to chromium-browser.
如何在系统上也可以使用google-chrome时使用Chromium运行Selenium?
How to run Selenium with Chromium when google-chrome is also available on the system?
更新1:更新备选方案如何?
UPDATE 1: what about update-alternatives ?
$ ls -lah /usr/bin/google-chrome
/usr/bin/google-chrome -> /etc/alternatives/google-chrome
$ ls -lah /etc/alternatives/google-chrome
/etc/alternatives/google-chrome -> /usr/lib/chromium-browser/chromium-browser
推荐答案
从这些文档:对于Linux系统,ChromeDriver期望/ usr / bin / google-chrome成为实际Chrome二进制文件的符号链接。另请参阅覆盖Chrome二进制位置部分。不幸的是,该部分似乎并不存在于该网页上,但我认为我在其他地方找到了它:在非标准位置执行,所以这是一条路:
From these docs: "For Linux systems, the ChromeDriver expects /usr/bin/google-chrome to be a symlink to the actual Chrome binary. See also the section on overriding the Chrome binary location ." Unfortunately that section does not appear to exist on that page but I think I found it elsewhere: executing in a non-standard location, so that's the way to go:
ChromeOptions options = new ChromeOptions();
options.setBinary("/path/to/other/chrome/binary");
这篇关于Selenium使用Chromium而不是谷歌浏览器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!