문제

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