-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAction1.java
More file actions
34 lines (24 loc) · 1.04 KB
/
Action1.java
File metadata and controls
34 lines (24 loc) · 1.04 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
package automation;
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.interactions.Actions;
public class Action1 {
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 driver = new FirefoxDriver();
driver.get("https://www.amazon.in/");
driver.manage().window().maximize();
//search box in amazon
WebElement search = driver.findElement(By.xpath("//input[@id='twotabsearchtextbox']"));
Actions act = new Actions(driver);
act.keyDown(search, Keys.SHIFT).sendKeys("pendrive").build().perform();
//search box button
driver.findElement(By.xpath("//input[@id='nav-search-submit-button']")).click();
Thread.sleep(4000);
driver.close();
}
}