-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLearnDropdown.java
More file actions
31 lines (24 loc) · 949 Bytes
/
LearnDropdown.java
File metadata and controls
31 lines (24 loc) · 949 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package week2.day1;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.support.ui.Select;
import io.github.bonigarcia.wdm.WebDriverManager;
public class LearnDropdown {
public static void main(String[] args) {
WebDriverManager.chromedriver().setup();
ChromeDriver driver = new ChromeDriver();
driver.get("http://www.leafground.com/pages/Dropdown.html");
driver.manage().window().maximize();
WebElement ele= driver.findElement(By.id("dropdown1"));
Select dd = new Select(ele);
dd.deselectByIndex(1);
dd.getOptions();
WebElement ele1= driver.findElement(By.name("dropdown2"));
Select dd1= new Select(ele1);
dd1.selectByVisibleText("Appium");
WebElement ele2= driver.findElement(By.id("dropdown3"));
Select dd2= new Select(ele2);
dd2.selectByIndex(3);
}
}