How to execute selenium test script in android, iOS, ipad using saucelabs -
i able run script in 3 browser using saucelabs, need run in mobile devices ipad. can 1 me how can add desiredcapabilities? code follows:
public static object[][] saucebrowserdataprovider(method testmethod) { return new object[][]{ //new object[]{"internet explorer", "11", "windows 8.1"}, //new object[]{"firefox", "44", "windows 7"}, new object[]{"browser", "44", "android"}, new object[]{"chrome", "51","windows 7"}, new object[]{"firefox", "44","ios"} }; } private webdriver createdriver(string browser, string version, string os) throws malformedurlexception { desiredcapabilities capabilities = new desiredcapabilities(); capabilities.setcapability(capabilitytype.browser_name, browser); if (version != null) { capabilities.setcapability(capabilitytype.version, version); } capabilities.setcapability(capabilitytype.platform, os); capabilities.setcapability("name", "sauce sample test"); webdriver.set(new remotewebdriver( new url("http://" + authentication.getusername() + ":" + authentication.getaccesskey() + "@ondemand.saucelabs.com:80/wd/hub"), capabilities)); sessionid.set(((remotewebdriver) getwebdriver()).getsessionid().tostring()); return webdriver.get(); } @test(dataprovider = "hardcodedbrowsers") public void webdriver(string browser, string version, string os) throws exception { webdriver driver = createdriver(browser, version, os); }
using code able run in 3 browsers not able run mobile devices. please me.
have u tried this:
capabilities.setcapability(capabilitytype.devicename, "google nexus 7 hd emulator"); capabilities.setcapability(capabilitytype.browsername, "safari");
i have tried similar browserstack , works.
please let me know.
Comments
Post a Comment