-1

I've Eclipse & JavaScript but when I run the script it fails to launch configs:

org.openqa.selenium.SessionNotCreatedException: Unable to 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 for the 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 to Sauce Lab's guinea-pig page and 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);
        }
    }
}
dur
  • 13,039
  • 20
  • 66
  • 96
Pooja
  • 3
  • 1

1 Answers1

0

You need to add /wd/hub at end of the URL. Try the below one,

public static final String URL = "https://" + USERNAME + ":" + ACCESS_KEY + "@ondemand.saucelabs.com:443/wd/hub";
Sudharsan Selvaraj
  • 4,751
  • 3
  • 11
  • 21