Professional Documents
Culture Documents
import java.util.List;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.support.ui.Select;
driver.get("https://en-gb.facebook.com/");
WebElement btnCreate =
driver.findElement(By.xpath("//a[text()='Create New
Account']"));
btnCreate.click();
Thread.sleep(3000);
WebElement ddnDay =
driver.findElement(By.id("day"));
Select s = new Select(ddnDay);
//s.selectByVisibleText("5");
//s.selectByIndex(2);
s.selectByValue("6");
System.out.println(allOptions.get(i).getText());
// WebElement we = allOptions.get(i);
//individual webelement
// String text = we.getText();
// System.out.println(text);
}
System.out.println("**********");
System.out.println(allOptions.get(i).getAttribute("value"));
System.out.println(x.getText());
System.out.println("************");
System.out.println(x.getAttribute("value"));