-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathXpathLocator2.java
More file actions
30 lines (20 loc) · 966 Bytes
/
XpathLocator2.java
File metadata and controls
30 lines (20 loc) · 966 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
package automation;
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class XpathLocator2 {
public static void main(String[] args) throws InterruptedException {
// TODO Auto-generated method stub
System.setProperty("webdriver.gecko.driver", "D:\\Quastech\\Software\\geckodriver-v0.30.0-win64\\geckodriver.exe");
//webdriver - interface(methods)
WebDriver driver = new FirefoxDriver();// class cum constructor
driver.get("https://www.naukri.com/");
driver.manage().window().maximize();
driver.findElement(By.xpath("//input[@id='qsb-keyword-sugg']")).sendKeys("Java");
driver.findElement(By.xpath("//input[@id='qsb-keyword-sugg']")).sendKeys("Mumbai");
driver.findElement(By.xpath("//button[contains(text(),'Search')]")).sendKeys(Keys.ENTER);
Thread.sleep(4000);
driver.close();
}
}