-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDropdownPractice.java
More file actions
33 lines (26 loc) · 967 Bytes
/
DropdownPractice.java
File metadata and controls
33 lines (26 loc) · 967 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
33
package VINDVG1.Vinay27;
import java.util.List;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
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 DropdownPractice {
public static void main(String[] args) {
WebDriverManager.chromedriver().setup();
WebDriver driver=new ChromeDriver();
driver.get("https://www.globalsqa.com/demo-site/select-dropdown-menu/#google_vignette");
driver.manage().window().maximize();
Select Ab= new Select(driver.findElement(By.xpath("//*[@id=\"post-2646\"]/div[2]/div/div/div/p/select")));
Ab.selectByValue("IND");
List<WebElement>Vs=Ab.getOptions();
int q=Vs.size();
for(int i=0; i<q; i++)
{
String Options = Vs.get(i).getText();
System.out.println(Options);
}
System.out.println(Vs.size());
}
}