Skip to content

Instantly share code, notes, and snippets.

@zdwolfe
Last active October 18, 2015 20:22
Show Gist options
  • Save zdwolfe/fcba7febc656646d70d1 to your computer and use it in GitHub Desktop.
Save zdwolfe/fcba7febc656646d70d1 to your computer and use it in GitHub Desktop.
@DataProvider(name = "searchBoxProvider")
public Object[][] searchBoxProvider() {
return new Object[][] {
{ "http://www.google.com", "lst-ib" },
{ "https://duckduckgo.com", "search_form_input_homepage"},
{ "https://www.dogpile.com/", "topSearchTextBox"},
{ "http://www.bing.com", "sb_form_q"}
};
}
@Test(dataProvider = "searchBoxProvider")
public void shouldHaveVisibleSearchBox(String url, String searchBoxId) {
WebDriver driver = new FirefoxDriver();
driver.get(url);
if (StringUtils.equals(url, "https://duckduckgo.com")) {
WebElement adCloseButton = driver.findElement(By.id('mainAdCloseButton'));
adCloseButton.click();
}
WebElement searchBox = driver.findElement(By.id(searchBoxId));
assertTrue(searchBox.isDisplayed());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment