-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDropdownlist.java
More file actions
32 lines (28 loc) · 931 Bytes
/
Dropdownlist.java
File metadata and controls
32 lines (28 loc) · 931 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
32
package VINDVG1.Vinay27;
import java.util.List;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.Select;
import io.github.bonigarcia.wdm.WebDriverManager;
public class Dropdownlist {
public static void main(String[] args) {
WebDriverManager.chromedriver().setup();
WebDriver driver=new ChromeDriver();
driver.get("https://demoqa.com/select-menu");
Select se=new Select (driver.findElement(By.xpath("//*[@id=\"oldSelectMenu\"]")));
List<WebElement> vs=se.getOptions();
int Vinay=vs.size();
//for(int i=0;i<Vinay;i++)
//{
//String options =vs.get(i).getText();
//System.out.println(options);
//}
for(int i=10;i<Vinay;i--)
{
String Options =vs.get(i).getText();
System.out.println(Options);
}
}
}