Snippet for Printing Values from Drop Down dox (WebDriver)
WebElement dropdown=driver.findElement(By.xpath("//*[@id='gh-cat']"));
List<WebElement> dropdownoptions = dropdown.findElements(By.tagName("option"));
for(int i=0; i<dropdownoptions.size(); i++)
{
System.out.println(dropdownoptions.get(i).getText());
}
No comments:
Post a Comment