在Sauce Labs中运行Java Selenium测试需要哪些设置?

时间:2016-11-10 06:47:41

标签: java selenium automation automated-tests saucelabs

我是Eclipse& JavaScript,但是当我运行脚本时,它无法启动配置:

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代码:

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);
        }
    }
}

1 个答案:

答案 0 :(得分:0)

您需要在网址末尾添加SELECT t3.ID, t3.contact_id, t0.ID, t0.DTYPE, t1.NAME, t2.ID, t2.FOUNDED FROM contacts t0 LEFT OUTER JOIN person t1 ON (t1.ID = t0.ID) LEFT OUTER JOIN company t2 ON (t2.ID = t0.ID), account t3 WHERE (t0.ID = t3.contact_id) SELECT ID, OUTDOOR, PERSON_ID FROM hobby WHERE (PERSON_ID = ?) SELECT ID, OUTDOOR, PERSON_ID FROM hobby WHERE (PERSON_ID = ?) SELECT ID, OUTDOOR, PERSON_ID FROM hobby WHERE (PERSON_ID = ?) SELECT ID, OUTDOOR, PERSON_ID FROM hobby WHERE (PERSON_ID = ?) SELECT ID, OUTDOOR, PERSON_ID FROM hobby WHERE (PERSON_ID = ?) ... 。试试下面的一个,

/wd/hub