Srikrishna Nadagouda
Srikrishna Nadagouda

Reputation: 68

I want to perform right click using webdriver in Chrome ? Please Suggest

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

Answers (3)

Mamoon ur Rasheed
Mamoon ur Rasheed

Reputation: 317

This works for me in c#

Actions actions = new Actions(Driver.Instance);
actions.ContextClick(element).Perform();

Upvotes: 2

Rohit
Rohit

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

Ram Pasala
Ram Pasala

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

Related Questions