-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMultipleDropDown.java
More file actions
52 lines (42 loc) · 2.24 KB
/
Copy pathMultipleDropDown.java
File metadata and controls
52 lines (42 loc) · 2.24 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
package main.webdriver;
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;
import java.util.List;
/**
* Created by neeraj.bhatnagar on 1/2/2017.
*/
public class MultipleDropDown {
public static void main(String[] args) {
System.setProperty("webdriver.gecko.driver", System.getProperty("user.dir") + "\\GecoDriver\\geckodriver.exe");
WebDriver driver = new FirefoxDriver();
driver.get("http://www.wikipedia.org");
Select select = new Select(driver.findElement(By.xpath(".//*[@id='searchLanguage']")));
System.out.println("************************Printing All main.webdriver.Dropdowns values****************************************");
/*List<WebElement> options = driver.findElements(By.tagName("option"));
System.out.println("Size of list is" + "" + options.size()+ "" + "Elements");
for(int i = 0; i<options.size(); i++) {
System.out.println(options.get(i).getText());
System.out.println(options.get(i).getAttribute("value"));
}*/
System.out.println("****************************Print All links on page*************************************");
List<WebElement> links = driver.findElements(By.tagName("a"));
for (int j=0;j<links.size();j++){
System.out.println(links.get(j).getAttribute("href"));
System.out.println(links.get(j).getText());
}
System.out.println("*********************Total Links are**************** " + "" + links.size());
/*System.out.println("*********************************Print links from a block on webpage****************************");
List<WebElement> block = driver.findElements(By.xpath("./*//*[@class='footer-sidebar-text']/ul"));
System.out.println(block.size());
for (int k=0; k<block.size();k++){
System.out.println(block.get(k).getAttribute("href"));
System.out.println(block.get(k).getText());
}
System.out.println("Total Links in block :" + "" + block.size());
*/
//driver.quit();
}
}