Perform right click using WebDriver

0
15

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 :

  1. Actions action = new Actions(driver);
  2. //Actions class take WebDriver type object as argument
  3.  
  4.  action .moveToElement(webElement).perform();
  5.  
  6.  action .contextClick().perform();
Facebook Comments
(Visited 22 times, 1 visits today)

LEAVE A REPLY

Please enter your comment!
Please enter your name here