mar*_*ipf 6 selenium google-chrome
我有Selenium网络驱动程序的问题.我要做的是启动"便携式"chrome而不是本地安装,因为它有不同的设置.
问题是便携式Chrome(来自PortableApps)似乎只在使用GoogleChromePortable.exe时启动.如果我直接使用Chrome二进制文件,它将启动我的本地安装.使用Selenium似乎无论我传递给它的Chrome路径(GoogleChromePortable.exe或二进制路径),它都会启动我的本地安装.
这是我的代码:
String chromePath = "M:/my/path";
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
ChromeOptions options = new ChromeOptions();
capabilities.setCapability("chrome.binary", chromePath);
capabilities.setCapability(ChromeOptions.CAPABILITY, options);
Run Code Online (Sandbox Code Playgroud)
任何想法如何能够启动我的便携式铬?谢谢
对于其他偶然发现这个问题的人,以下是我如何设法启动便携式 Chrome 的方法:
ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.setBinary(binaryPath);
driver = new ChromeDriver(chromeOptions);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4200 次 |
| 最近记录: |