Printing Values from Drop Down dox (WebDriver) - Bug Reaper

                  Bug Reaper

Lean about Automation Testing,Selenium WebDriver,RestAssured,Appium,Jenkins,JAVA,API Automation,TestNG,Maven, Rest API, SOAP API,Linux,Maven,Security Testing,Interview Questions

Monday, 23 September 2013

Printing Values from Drop Down dox (WebDriver)



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