-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRightClick.java
More file actions
28 lines (22 loc) · 880 Bytes
/
RightClick.java
File metadata and controls
28 lines (22 loc) · 880 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
package actions;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.interactions.Action;
import org.openqa.selenium.interactions.Actions;
/**
* Created by jfarrier on 23/11/2016.
*/
public class RightClick {
public static void main(String[] args) throws InterruptedException {
//FirefoxDriver webdriver = new FirefoxDriver();
System.setProperty("webdriver.chrome.driver", "C:\\chromedriver.exe");
WebDriver webdriver = new ChromeDriver();
webdriver.get("http://www.google.com");
WebElement searchBar = webdriver.findElement(By.name("q"));
Actions builder = new Actions(webdriver);
Action rightClick = builder.contextClick(searchBar).build();
rightClick.perform();
}
}