有没有办法告诉chromedriver (chrome中的webdriver实现)使用金丝雀、测试版或当前生产的chrome?
发布于 2013-08-29 06:31:30
您可以要求ChromeDriver在非标准位置使用Chrome可执行文件
ChromeOptions options = new ChromeOptions();
options.setBinary("/path/to/other/chrome.exe");在Mac上,这应该是实际的二进制文件,而不仅仅是应用程序。例如/Applications/Google Chrome.app/Contents/MacOS/Google Chrome。
[通过_chromedriver功能和Switches_实现](https://sites.google.com/a/chromium.org/chromedriver/capabilities)
发布于 2013-08-29 21:33:04
在theintern中实现这一点的方法是通过以下配置
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"
}}
发布于 2018-03-03 03:12:27
它应该是这款谷歌Chrome Canary.app,而不仅仅是谷歌Chrome.app。
试试这个:
options.setBinary("/Applications/Google Chrome Canary.app/Contents/MacOS/Google Chrome Canary");
ChromeDriver driver = new ChromeDriver(options);https://stackoverflow.com/questions/18499367
复制相似问题