硒不能启动便携式铬,但本地安装 [英] Selenium not starting portable chrome but local installation

查看:110
本文介绍了硒不能启动便携式铬,但本地安装的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的Selenium网络驱动程序出现问题。我试图做的是启动一个便携式铬,而不是我的本地安装,因为它有不同的设置。

I have a problem with the Selenium web driver. What I'm trying to do is to start a "portable" chrome instead of my local installation, because it has different settings.

问题在于便携式Chrome来自PortableApps)似乎只在使用GoogleChromePortable.exe时才开始。如果我直接使用Chrome二进制文件,它将启动我的本地安装。
使用Selenium,似乎无论我将哪个Chrome路径传递给它(GoogleChromePortable.exe或二进制路径),它都会启动本地安装。

The problem is that the portable Chrome (from PortableApps) seems to only start when using GoogleChromePortable.exe. If I use the Chrome binary directly, it will start my local installation. With Selenium it seems that no matter what Chrome path I pass to it (GoogleChromePortable.exe or binary path), it starts my local installation.

这里是我的代码:

String chromePath = "M:/my/path";
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
ChromeOptions options = new ChromeOptions();
capabilities.setCapability("chrome.binary", chromePath);
capabilities.setCapability(ChromeOptions.CAPABILITY, options);

任何想法如何启动我的便携式Chrome浏览器?
谢谢

Any ideas how to be able to start my portable chrome? Thanks

推荐答案

对于其他人磕磕绊绊的问题,下面是我如何设法让便携式Chrome开始:

For anyone else stumbling upon this problem, here is how I managed to get the portable Chrome starting:

ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.setBinary(binaryPath);
driver = new ChromeDriver(chromeOptions);

这篇关于硒不能启动便携式铬,但本地安装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆