The Sauce Labs Cookbook

Sauce Headless

Front End Performance Testing


External Resources

More Info

Page tree
Skip to end of metadata
Go to start of metadata

This example uses the JUnit testing framework and authenticates to Sauce Labs using credentials set as environment variables

You can also clone this script directly from GitHub.

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
import io.appium.java_client.ios.IOSDriver;

public class SampleSauceTest {

  public static final String USERNAME = "YOUR_USERNAME";
  public static final String ACCESS_KEY = "YOUR_ACCESS_KEY";
  public static final String URL = "https://" + USERNAME + ":" + ACCESS_KEY + "";

    public static void main(String[] args) throws Exception {

        DesiredCapabilities capabilities = new DesiredCapabilities();
        capabilities.setCapability("platformName", "iOS");
        capabilities.setCapability("deviceName", "iPhone 6");
        capabilities.setCapability("platformVersion", "8.4");
        capabilities.setCapability("app", "");
        capabilities.setCapability("browserName", "");
        capabilities.setCapability("deviceOrientation", "portrait");
        capabilities.setCapability("appiumVersion", "1.5.3");

        WebDriver driver = new IOSDriver(new URL(URL), capabilities);

         * Test Actions here...



  1. Anonymous

    In the line "Webdriver driver = new IOSDriver<>(...);


    The "<>" is not supported in Java8.  

  2. Anonymous

    Hi SauceLabs,


    The sample code in this page shows "WebDriver driver = new IOSDriver<>(new URL(""), capabilities);"
    Shouldn't it be "driver = new IOSDriver<>(new URL(URL), capabilities);" ?


  3. Anonymous

    It should be iOSDriver rather


    1. Hi, we had a member of our Professional Services team verify that it is IOSDriver.