July 2019
Intermediate to advanced
536 pages
12h 57m
English
Now that we have seen context click on a WebElement, it's time to explore the contextClick() method at the current mouse location. The API syntax for the contextClick() method is as follows:
public Actions contextClick()
As expected, the preceding method doesn't expect any input parameter and returns the Actions instance. Let's see the necessary modifications needed for the previous example to use this method. The following is the code refactored to achieve this:
@Testpublic void shouldContextClickAtCurrentLocation() { driver.get("http://guidebook.seleniumacademy.com/ContextClick.html"); WebElement contextMenu = driver.findElement(By.id("div-context")); Actions actions = new Actions(driver); actions.moveToElement(contextMenu) ...
Read now
Unlock full access