Run WebDriver with Chrome Canary?

醉酒当歌 提交于 2019-12-07 13:40:31

问题


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


回答1:


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]




回答2:


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

}




回答3:


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);


来源:https://stackoverflow.com/questions/18499367/run-webdriver-with-chrome-canary

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!