Skip to content

Instantly share code, notes, and snippets.

@fwielstra
Created May 16, 2011 09:14
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save fwielstra/974127 to your computer and use it in GitHub Desktop.
An example of a Selenium WebRunner test
@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
// wait until the page has been loaded
SeleniumUtils.waitForElementPresent(selenium, "xpath=//tr[@id='wo-1001']");
// do an assertion
assertEquals("CANCELLED", selenium.getText("xpath=//tr[@id='wo-1001']/td[3]"));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment