All Downloads are FREE. Search and download functionalities are using the official Maven repository.

.saucerest.1.0.22.source-code.ExampleUsage Maven / Gradle / Ivy

Go to download

Java library which provides helper methods for invoking the Sauce Labs REST API

There is a newer version: 2.5.3
Show newest version
import com.saucelabs.saucerest.SauceREST;
import org.json.simple.JSONArray;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

/* to get your jobID:
 * Selenium 1: String jobID = browser.getEval("selenium.sessionId");
 * Selenium 2: String jobID = ((RemoteWebDriver) driver).getSessionId().toString();
 */

public class ExampleUsage {
    public static void main(String[] args) throws IOException {
        if (args.length == 0) {
            System.out.println("Usage: java -cp saucerest-java.jar ExampleUsage   ");
            System.exit(1);
        }

        SauceREST client = new SauceREST(args[0], args[1]);

        Map updates = new HashMap();
        updates.put("name", "this job has a name");
        updates.put("passed", true);
        JSONArray tags = new JSONArray();
        tags.add("testingblah");
        updates.put("tags", tags);
        client.updateJobInfo(args[2], updates);
        System.out.println(client.getJobInfo(args[2]));
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy