Created
March 18, 2018 15:54
-
-
Save andreidbr/186cbe03038f74729de8729dad9b786e to your computer and use it in GitHub Desktop.
A forEach loop in Selenium
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test(testName = "06 Filter Functionality Test", description = "Check that the 06 Filter page functions correctly", groups = {"06Filter"}) | |
public void verifyFilterTest() throws InterruptedException { | |
driver.findElement(By.xpath("/html/body/div[2]/div[6]")).click(); | |
driver.findElement(By.xpath("/html/body/form/input")).sendKeys("an"); | |
Thread.sleep(500); | |
driver.findElement(By.xpath("/html/body/form/input")).sendKeys("dr"); | |
if (driver.findElement(By.className("name")).isDisplayed()) { | |
List<WebElement> resultList = driver.findElements(By.className("name")); | |
for (WebElement result : resultList) { | |
Assert.assertTrue(result.getText().toLowerCase().contains("andr")); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment