Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.List;
- import java.util.concurrent.TimeUnit;
- 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.firefox.FirefoxDriver;
- import org.openqa.selenium.support.ui.Select;
- public class DellDropdown {
- public static void main(String[] args) {
- WebDriver driver=new FirefoxDriver();
- driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
- driver.get("http://www.dell.com/");
- WebElement dropdown=driver.findElement(By.xpath("//select[@class='para_small']"));
- Select select=new Select(dropdown);
- select.selectByIndex(5);
- List<WebElement> options=select.getOptions();
- for(int i=0;i<options.size();i++)
- {
- options.get(i).getText();
- }
- }
- }
- wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//select[@class='para_small']")))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement