Run WebDriver with Chrome Canary?

2019-07-04 11:21发布

Is there a way to tell chromedriver (the webdriver implementation within Chrome) to use Canary, Beta or current production chrome?

3条回答
Deceive 欺骗
2楼-- · 2019-07-04 11:39

It should be this Google Chrome Canary.app and not just Google Chrome.app.
Try this:

options.setBinary("/Applications/Google Chrome Canary.app/Contents/MacOS/Google Chrome Canary");
ChromeDriver driver = new ChromeDriver(options);
查看更多
【Aperson】
3楼-- · 2019-07-04 11:54

You can ask ChromeDriver to use a Chrome executable in a non-standard location

ChromeOptions options = new ChromeOptions();
options.setBinary("/path/to/other/chrome.exe");

On Mac OS X, this should be the actual binary, not just the app. e.g., /Applications/Google Chrome.app/Contents/MacOS/Google Chrome.

[via chromedriver Capabilities and Switches]

查看更多
女痞
4楼-- · 2019-07-04 12:04

And the way to do this in theintern is by the following config

capabilities: {
    'selenium-version': '2.35.0',
    'chrome': {chromeOptions: {'binary': '/Applications/Google\ Chrome\ Canary.app/Contents/MacOS/Google\ Chrome\ Canary'}},
},

Also, if you're looking to configure the selenium node directly here's how to pass the configuration in:

{
"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"
}

}

查看更多
登录 后发表回答