I am wondering if anyone knows how to specify the version number of Chrome in a Selenium Capabilities object?

Would it be:

DesiredCapabilities capabilities = DesiredCapabilities.chrome();
capabilities.setCapability("version", "30");
capabilities.setCapability("platform", Platform.WIN8);

Or, would you do it like this:

DesiredCapabilities capabilities = DesiredCapabilities.chrome();
capabilities.setCapability("version", "30.0.1599.101");
capabilities.setCapability("platform", Platform.WIN8);

I think I am making a very good assumption that one of these will not work and no error would be thrown in that case. Or would a Double work best, like "30.0" ?

有帮助吗?

解决方案

Assuming you are using this for RemoteWebdriver, the version number wouldn't make any difference. When selenium hub receives the test request for a browser, it will compare all capabilities that was requested for with the remote control capabilities. If it doesn't find one that matches all capabilities, it will fail.

In your case, if you registered the RemoteControl with capability - browser browserName=chrome,version=30 then only the first option in your question will work.

Alternatively, if you are not specifying browser parameter then you need to hover over the browser image in Grid console and find out the version number.

其他提示

This is how I specify

 DesiredCapabilities caps = DesiredCapabilities.chrome();
    caps.setCapability("platform", "Windows 8");
    caps.setCapability("version", "");

you can get the code for different combination of browser and OS here

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top