Dropdown & navigation Tests
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
package com.agile611.testng.webdriver;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.openqa.selenium.By;
|
||||
import org.openqa.selenium.WebElement;
|
||||
import static org.testng.Assert.assertTrue;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class DropdownTest extends BaseTest {
|
||||
|
||||
@Test
|
||||
@@ -14,11 +15,13 @@ public class DropdownTest extends BaseTest {
|
||||
.navigate().to("https://the-internet.herokuapp.com/dropdown");
|
||||
List<WebElement> options =
|
||||
driver.findElements(By.xpath(".//*[@id='dropdown']/option"));
|
||||
|
||||
for (int i = 1; i < options.size(); i++) {
|
||||
WebElement option =
|
||||
driver.findElement(
|
||||
By.xpath(".//*[@id='dropdown']/option[" + (i + 1) + "]"));
|
||||
option.click();
|
||||
assertTrue(option.isSelected());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -19,5 +19,3 @@ public class NavigationTest extends BaseTest {
|
||||
Thread.sleep(2000);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user