Skip to content

Instantly share code, notes, and snippets.

@sebv
Created December 20, 2013 07:38
Show Gist options
  • Save sebv/8051581 to your computer and use it in GitHub Desktop.
Save sebv/8051581 to your computer and use it in GitHub Desktop.
import com.saucelabs.common.SauceOnDemandAuthentication;
import com.saucelabs.common.SauceOnDemandSessionIdProvider;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TestName;
import org.openqa.selenium.Platform;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import java.net.URL;
import static junit.framework.Assert.assertEquals;
/**
* Simple {@link RemoteWebDriver} test that demonstrates how to run your Selenium tests with <a href="http://saucelabs.com/ondemand">Sauce OnDemand</a>.
* *
* @author Ross Rowe
*/
public class WebDriverTest {
private WebDriver driver;
@Before
public void setUp() throws Exception {
DesiredCapabilities capabillities = DesiredCapabilities.iphone();
capabillities.setCapability("browserName", "");
capabillities.setCapability("platform", "MAC");
capabillities.setCapability("version", "6.1");
capabillities.setCapability("device-orientation", "portrait");
capabillities.setCapability("app", "safari");
capabillities.setCapability("device", "iPhone Simulator");
this.driver = new RemoteWebDriver(
new URL("http://<SAUCE_USERNAME>:<SAUCE_KEY>@ondemand.saucelabs.com:80/wd/hub"),
capabillities);
}
@Test
public void webDriver() throws Exception {
driver.get("http://www.amazon.com/");
//assertEquals("Amazon.com: Online Shopping for Electronics, Apparel, Computers, Books, DVDs & more", driver.getTitle());
}
@After
public void tearDown() throws Exception {
driver.quit();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment