Im using Selenium and Java Webdriver and I'm new to Selenium. I have a similar problem as in this Thread and I tried several approaches. I just want to get the first element of this dropdown (which will get longer soon) and select it to test the input mask with junit. Here is a snippet of the website:
<md-option ng-repeat="customer in settingsCtrl.customers" value="1" tabindex="0" class="ng-scope md-ink-ripple" role="option" aria-selected="true" id="select_option_4" style="" selected="selected">
<div class="md-text ng-binding">FirstCustomer</div>
<div class="md-ripple-container" style=""></div>
</md-option>
I tried following:
WebDriverWait wait = new WebDriverWait(driver, 300);
WebElement customer = driver.findElement(By.id("select_option_4"));
//customer.click();
//wait.wait();
List <WebElement> rows = customer.findElements(By.tagName("div"));
System.out.println("row size: " + rows.size());
// Debug text
Iterator<WebElement> i = rows.iterator();
while(i.hasNext()){
WebElement row = i.next();
System.out.println("row text: " + row.getText() );
}
rows.get(0).click();
The error msg is as in the thread: ElementNotVisibleException
Any suggestions?