使用Chrome Canary运行WebDriver?

时间:2013-08-28 22:31:30

标签: selenium-chromedriver

有没有办法告诉chromedriver(Chrome中的webdriver实施)使用Canary,Beta或当前的生产Chrome?

3 个答案:

答案 0 :(得分:9)

您可以要求ChromeDriver在非标准位置使用Chrome可执行文件

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

在Mac OS X上,这应该是实际的二进制文件,而不仅仅是应用程序。例如,/Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[via chromedriver Capabilities and Switches]

答案 1 :(得分:4)

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

}

答案 2 :(得分:0)

这应该是谷歌Chrome Canary.app而不仅仅是谷歌Chrome.app。
试试这个:

options.setBinary("/Applications/Google Chrome Canary.app/Contents/MacOS/Google Chrome Canary");
ChromeDriver driver = new ChromeDriver(options);