-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathselectFacebook.java
More file actions
37 lines (25 loc) · 835 Bytes
/
Copy pathselectFacebook.java
File metadata and controls
37 lines (25 loc) · 835 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package com.qpiders;
import java.util.ArrayList;
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.firefox.FirefoxDriver;
import org.openqa.selenium.support.ui.Select;
public class selectFacebook {
/**
* @param args
*/
public static void main(String[] args) {
WebDriver driver = new FirefoxDriver();
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
driver.get("https://www.facebook.com/");
//find the year select element
WebElement listYear = driver.findElement(By.id("year"));
Select select = new Select(listYear);
select.selectByVisibleText("1987");
List<WebElement> allOptions = select.getOptions();
// ArrayList<E>
}
}