Vel Ganesh
Vel Ganesh

Reputation: 553

Error on setting DesiredCapabilities for SauceLabs execution

The following was configured based on config listed in https://saucelabs.com/platforms.

DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("platform", "Windows 8.1");
capabilities.setCapability("browserName", "firefox");
capabilities.setCapability("version", "33.0.");
capabilities.setCapability("name", "Bamboo Job");
driver = new RemoteWebDriver(new URL("http://user:key@localhost:4445/wd/hub"),capabilities);

The above code results in the below error:

java.lang.IllegalArgumentException: No enum constant org.openqa.selenium.Platform.Windows 8.1
at java.lang.Enum.valueOf(Enum.java:236)
at org.openqa.selenium.Platform.valueOf(Platform.java:30)
at org.openqa.selenium.remote.DesiredCapabilities.setCapability(DesiredCapabilities.java:168)
at com.automation.tool.internal.InitiateBrowser.getBrowser(InitiateBrowser.java:17)
at com.automation.tool.Automation_Tool.(Automation_Tool.java:36)
at ui_automation.Login_Validation.setUp(Login_Validation.java:19)

But when I supply values in the Platform enum, then the whole suite passes. ex:- WINDOWS, WIN8_1 But it is not possible to mention version in Mac or Linux using this method.

Please let me know how to fix this error.

Upvotes: 0

Views: 1542

Answers (2)

foal
foal

Reputation: 731

It is a "feature" of Selenium 2.44. See the issue 8083. You should use Seleniun 2.43.1.

Upvotes: 0

Louis
Louis

Reputation: 151441

The contents of the platform setting is not determined by Selenium but by Sauce Labs. They have a whole page dedicated to telling you exactly what to put there. You can select the platform, browser, browser version and it will tell you exactly what you need.

At any rate the platform string for Linux is the string "Linux". For Macs you have multiple choices depending on the version of the OS you want. The ones I saw were:

"OS X 10.10"
"OS X 10.9"
"OS X 10.8"
"OS X 10.6"

Upvotes: 1

Related Questions