ITSourceCode.com

We Exist to Provide 100% Free Source Code and Tutorials

Custom Search

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 :

  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

Check Your Domain Ranking

Leave a Reply

Your email address will not be published. Required fields are marked *

ITSourceCode.com © 2016 Frontier Theme

Subscribe For Latest Updates

Signup for our newsletter and get notified when we publish new articles for free!