Opening Right-click Menu / Context menu with Selenium WebDriver

Selenium WebDriver providesActionBuilder to perform complex user interactions with a web page. It allows chaining multiple actions together to perform a complex action.

You can create a complex action and execute the action (perform) it in the following manner. (Ruby)

 

The action to open the context menu is context_click() .

By default, it will click on the middle of the element if you provide one.  Otherwise, it will click where the mouse pointer is at.

If you want to move the pointer to a specific location of the page before clicking, use methodmove_to.

 

If you want to select an item from the context menu use arrow keys and enter then perform the action. You can also further pinpoint the cursor position by using  custom position from your element reference

 

Ref: http://www.rubydoc.info/gems/selenium-webdriver/Selenium/WebDriver/ActionBuilder

Leave a Reply

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