Perform right click using WebDriver


In this post, we will discuss how to perform right click if we are using Selenium WebDriver for automation testing.
For this purpose, we need to use Action class . Under Action class various method are defined for serving various actions that are needed to be performed while testing. For right click operation, we have contextClick() method available under Actions class. Below is the sample code :

Actions action = new Actions(driver);
//Actions class take WebDriver type object as argument

action .moveToElement(webElement).perform();

action .contextClick().perform();

Facebook Comments


Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.