What setups I need to run a Java Selenium test in Sauce Labs? -
i've eclipse & javascript when run script fails launch configs:
org.openqa.selenium.sessionnotcreatedexception: unable create new remote session. desired capabilities = capabilities [{browsername=chrome, version=latest, platform=win8_1}], required capabilities = capabilities [{}] build info: version: 'unknown', revision: '1969d75', time: '2016-10-18 09:43:45 -0700' system info:os.name: 'windows 8.1', os.arch: 'amd64', os.version: '6.3', java.version: '1.8.0_65' driver info: driver.version:
remotewebdriver code:
import org.openqa.selenium.webdriver; import org.openqa.selenium.remote.desiredcapabilities; import org.openqa.selenium.remote.remotewebdriver; import java.net.url; public class samplesaucetest { public static final string username = "username "; public static final string access_key = "access_key"; public static final string url = "https://" + username + ":" + access_key + "@ondemand.saucelabs.com:443"; public static void main(string[] args) throws exception { desiredcapabilities caps = desiredcapabilities.chrome(); caps.setcapability("platform", "windows 8.1"); caps.setcapability("version", "latest"); caps.setcapability("browsername", "chrome"); system.out.println(url); try { webdriver driver = new remotewebdriver(new url(url), caps); /** * goes sauce lab's guinea-pig page , prints title */ driver.get("https://saucelabs.com/test/guinea-pig"); // system.out.println("title of page is: " + driver.gettitle()); // driver.quit(); } catch(exception e) { system.out.println(e); } } }
you need add /wd/hub
@ end of url. try below one,
public static final string url = "https://" + username + ":" + access_key + "@ondemand.saucelabs.com:443/wd/hub";
Comments
Post a Comment