Skip to content

Instantly share code, notes, and snippets.

@testingbot
Created April 20, 2012 13:19
Show Gist options
  • Save testingbot/2428497 to your computer and use it in GitHub Desktop.
Save testingbot/2428497 to your computer and use it in GitHub Desktop.
webdriver example java
import junit.framework.TestCase;
import org.openqa.selenium.*;
import org.openqa.selenium.remote.*;
import java.net.URL;
import java.util.concurrent.TimeUnit;
public class SimpleTest extends TestCase {
private WebDriver driver;
public void setUp() throws Exception {
DesiredCapabilities capabillities = DesiredCapabilities.firefox();
capabillities.setCapability("version", "11");
capabillities.setCapability("platform", Platform.WINDOWS);
capabillities.setCapability("name", "Testing Selenium 2");
this.driver = new RemoteWebDriver(
new URL("http://key:secret@hub.testingbot.com:4444/wd/hub"),
capabillities);
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
}
public void testSimple() throws Exception {
this.driver.get("http://www.google.com");
assertEquals("Google", this.driver.getTitle());
}
public void tearDown() throws Exception {
this.driver.quit();
}
}
@djangofan
Copy link

Cool, i learned something new with your use of DesiredCapabilites ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment