It seems that Selenium is having trouble retrieving the text from the dropdown options.
Here is a snippet of the code I am working on:
WebElement dropdown=driver.findElement(By.id("selFromAccount"));
List<WebElement> dropoptions=dropdown.findElements(By.tagName("option"));
for(int i=0;i<dropoptions.size();i++)
{
System.out.println("Text is "+ dropoptions.get(i).getText());
}
System.out.println(dropoptions.size());
The HTML structure is as follows:
<div class=" autocomplete autocomplete-select">
... (omitted for brevity)
</div>
The current output looks like this:
Text is Text is Text is 3
Although the count is correct, the values themselves are not being printed out.
I am trying to test for the value "Please select a From Account" and then proceed to select an option from the dropdown. Any suggestions or help would be greatly appreciated!