How To Perform Right Click Action (Context Click) In Selenium

Perform Right Click Action In Selenium:

In some scenarios, we may need to do right click action / context click on an element to do some actions. We use Actions class in Selenium WebDriver to work on Mouse and Keyboard Actions. Check out the below link for detailed explanation of Actions Class.

Must Read: Actions Class in Selenium WebDriver

Coming back to the current post, here we I take a scenario to do right click action on an element and get the text of an item

Scenario to be automated:

  1. Launch the web browser and open the application
  2. Find the required element and do right click on the element
  3. Go to the options ‘copy’ and get the text of it and print it
  4. Close the browser to end the program

Copy the below mentioned script and work on this scenario.

Given clear explanation in the comments section with in the program itself. Please go through it to understand the flow.

If you are not regular reader of my blog then I highly recommend you to signup for the free email newsletter using the below link.

Sharing is caring.

Share on facebook
Facebook
Share on twitter
Twitter
Share on linkedin
LinkedIn

Like This Post?

We have a lot more where that came from?

We only send really good stuff occasionally, promise.

Rajkumar SM

Leave a Comment

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

Share on facebook
Share on google
Share on twitter
Share on linkedin
Share on whatsapp

Recent Posts:

Scroll to Top
API Testing eBook

DOWNLOAD FOR FREE