-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathContextMenu.java
More file actions
62 lines (49 loc) · 1.48 KB
/
ContextMenu.java
File metadata and controls
62 lines (49 loc) · 1.48 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
51
52
53
54
55
56
57
58
59
60
61
62
package Tests;
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.Actions;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
import io.github.bonigarcia.wdm.WebDriverManager;
public class ContextMenu {
private static WebDriver driver = null;
public static String browserName = null;
@BeforeTest
public void setUp() {
WebDriverManager.chromedriver().setup();
driver = new ChromeDriver();
}
@Test
public void testingAB() {
// Go to the page of dummy Website
driver.get("http://the-internet.herokuapp.com");
// Click the Context Menu link
driver.findElement(By.xpath("//*[@id=\"content\"]/ul/li[7]/a")).click();
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
// Instantiate Action Class
Actions actions = new Actions(driver);
// Retrieve WebElement to perform right click and Right Click the button to
// display Context Menu
actions.contextClick(driver.findElement(By.id("hot-spot"))).perform();
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
@AfterTest
public void tearDown() {
driver.close();
driver.quit();
System.out.println("Right click Tested successfully");
}
}