Selenium chromedriver 用Chrome Canary运行WebDriver?
有没有办法告诉(Chrome中的实现)使用Canary、Beta或当前生产的Chrome?您可以要求ChromeDriver在非标准位置使用Chrome可执行文件Selenium chromedriver 用Chrome Canary运行WebDriver?,selenium-chromedriver,Selenium Chromedriver,有没有办法告诉(Chrome中的实现)使用Canary、Beta或当前生产的Chrome?您可以要求ChromeDriver在非标准位置使用Chrome可执行文件 ChromeOptions options = new ChromeOptions(); options.setBinary("/path/to/other/chrome.exe"); 在Mac OS X上,这应该是实际的二进制文件,而不仅仅是应用程序。e、 例如,/Applications/Google Chrome.app/Co
ChromeOptions options = new ChromeOptions();
options.setBinary("/path/to/other/chrome.exe");
在Mac OS X上,这应该是实际的二进制文件,而不仅仅是应用程序。e、 例如,/Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[通过执行此操作的方法是通过以下配置
capabilities: {
'selenium-version': '2.35.0',
'chrome': {chromeOptions: {'binary': '/Applications/Google\ Chrome\ Canary.app/Contents/MacOS/Google\ Chrome\ Canary'}},
},
此外,如果您希望直接配置selenium节点,下面介绍如何将配置传入:
{
"capabilities": [
{
"browserName": "chrome",
"platform": "MAC"
},
{
"browserName": "chromeCanary",
"platform": "MAC",
"chromeOptions": {
"binary": "/Applications/Google\ Chrome\ Canary.app/Contents/MacOS/Google\ Chrome\ Canary"
},
"maxInstances": 1,
"seleniumProtocol": "WebDriver"
},
{
"browserName": "firefox",
"platform": "MAC"
}
],
"configuration": {
"host": "localhost",
"port": 8989,
"hubPort": 4444,
"hubHost": "localhost"
}
}应该是这个Google Chrome Canary.app,而不仅仅是Google Chrome.app。
试试这个:
options.setBinary("/Applications/Google Chrome Canary.app/Contents/MacOS/Google Chrome Canary");
ChromeDriver driver = new ChromeDriver(options);
ChromeDriver 2.6中修复了一个错误:请更新至最新版本。该选项现在似乎已重命名为
options.setChromeBinaryPath()
,因为ChromeDriver 2.16.333243和webdriver2.46.1