By using ID:
List<WebElement> allText=new Select(driver1.findElement(By.id(getId("ID1")))).getOptions();
int i=0;
for(webElement ele:allText)
{
System.out.println(ele.get(i).getText());
i++;
}
By using xpath :
List<WebElement> allText = driver.findElements(By.xpath("//*[@id="vehicleTypeName"]/option"));
int i=0;
for(webElement ele:allText)
{
System.out.println(ele.get(i).getText());
i++;
}
No comments:
Post a Comment