How to perform Right-click/Context-click in Selenium Webdriver.

Using ‘Action class‘ we can easily perform Right-click/Context-click on any Web-element.

Step 1: Store the Path of Web-element to be Right-clicked  in to the Web-element.
             Lets say  We have a Web-element name Test_element which we are right-clicking.
Step2:  We will use Action class to perform the Right-click/Context-click on our Web-element.

 Actions actions = new Actions(driver);    
Action action=actions.contextClick(Test_element).build();


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s