Reputation: 68
I want to perform right click using web driver in Chrome ? Please Suggest
Below is the code I am using:-
Actions actions = new Actions(driver);
Action action=actions.contextClick(element).build();
action.perform();
Upvotes: 1
Views: 3249
Reputation: 317
This works for me in c#
Actions actions = new Actions(Driver.Instance);
actions.ContextClick(element).Perform();
Upvotes: 2
Reputation: 380
Actions action= new Actions(driver);
action.contextClick(element).sendKeys(Keys.ARROW_DOWN).sendKeys(Keys.RETURN).build().perform();
if you want to select the first option from the right click drop down.
Upvotes: 1
Reputation: 5231
Try the below code:
Actions act = new Actions(driver); // where driver is WebDriver type
act.moveToElement(webElement).perform();
act.contextClick().perform();
Upvotes: 0