Advertisement
Guest User

Untitled

a guest
Apr 19th, 2014
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. import java.util.List;
  2. import java.util.concurrent.TimeUnit;
  3. import org.openqa.selenium.By;
  4. import org.openqa.selenium.WebDriver;
  5. import org.openqa.selenium.WebElement;
  6. import org.openqa.selenium.chrome.ChromeDriver;
  7. import org.openqa.selenium.firefox.FirefoxDriver;
  8. import org.openqa.selenium.support.ui.Select;
  9.  
  10. public class DellDropdown {
  11.  
  12. public static void main(String[] args) {
  13. WebDriver driver=new FirefoxDriver();
  14. driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
  15. driver.get("http://www.dell.com/");
  16. WebElement dropdown=driver.findElement(By.xpath("//select[@class='para_small']"));
  17. Select select=new Select(dropdown);
  18. select.selectByIndex(5);
  19. List<WebElement> options=select.getOptions();
  20. for(int i=0;i<options.size();i++)
  21. {
  22. options.get(i).getText();
  23. }
  24. }
  25. }
  26.  
  27. wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//select[@class='para_small']")))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement