I have a dropdown with some countries as follows,
I want to send the values US,CA,AF,AL,DZ,AS,AD to an array, loop it and print by using Selenium and Java.
I tried the following
WebElement elementdrop = d.findElement(By.xpath("path"));
List<WebElement> dropdownvalues = d.findElements(By.xpath("path"));
for(WebElement value:dropdownvalues)
{
String pcvalues=value.getText();
System.out.println("value names" + pcvalues);
}
This will print United States Canada Afghanistan Albania etc. But I want like US CA AF AL DZ AS AD
