forked from nbhat1/Selenium-JavaCode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclick.java
More file actions
26 lines (22 loc) · 1001 Bytes
/
Copy pathclick.java
File metadata and controls
26 lines (22 loc) · 1001 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
package main.webdriver;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
public class click {
public static void main(String[] args) {
// TODO Auto-generated method stub
System.setProperty("webdriver.gecko.driver", System.getProperty("user.dir") + "\\GecoDriver\\geckodriver.exe");
WebDriver driver = new FirefoxDriver();
driver.findElement(By.xpath("//*[@id='nav-primary']/ul/li[1]/a")).click();
String gettext = driver.findElement(By.xpath("//*[@id='nav-primary']/ul/li[1]/a")).getText();
System.out.println(gettext);
//WebElement element1 = driver.findElement(By.xpath("//*[@id='nav-sub-menu-information-and-services']/div/div[1]/ul/li[3]/a"));
//element1.click();
/*
WebElement element = driver.findElement(By.linkText("Industries"));
element.click();
*/
}
}