1Iterator<WebElement> itr = allLinks.iterator();
2while(itr.hasNext()) {
3 System.out.println(itr.next().getText());
4}
1public Boolean selectByText( String text ) {
2 WebElement dropDown = driver.findElement( By.xpath( ".//dropdown/path" ) );
3 dropDown.click();
4 List<WebElement> allOptions = dropDown.findElements(By.xpath(".//option"));
5 for ( WebElement we: allOptions) {
6 dropDown.sendKeys( Keys.DOWN ); //simulate visual movement
7 sleep(250);
8 if ( we.getText().contains( text ) ) select.selectByVisibleText("Value1");
9 }
10}