Skip to content

Instantly share code, notes, and snippets.

Avatar

Freek Wielstra fwielstra

View GitHub Profile
@fwielstra
fwielstra / someIntegrationTest.java
Created May 16, 2011
An example of a Selenium WebRunner test
View someIntegrationTest.java
@Test
public void runSomeIntegrationTest() {
WebDriver driver = new FirefoxDriver()
Selenium selenium = new WebDriverBackedSelenium(driver, SharedConfiguration.BASE_URL);
selenium.open("page.html");
// wait until the table row has been loaded
SeleniumUtils.waitForElementPresent(selenium, "xpath=//tr[@id='task-TASK_001']");
// navigate to the associated details page
SeleniumUtils.clickElement(driver, By.linkText("1001"));
// the browser now opens the details.html page
View WebDriverSupplier.java
public class WebDriverSupplier {
private static final Supplier<WebDriver> FIREFOX_SUPPLIER = new Supplier<WebDriver>() {
private WebDriver firefoxDriver;
@Override
public WebDriver get() {
if (firefoxDriver == null) {
firefoxDriver = new FirefoxDriver();
}