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
page.driver.browser.action.move_to(<span class="id identifier rubyid_el">webdriver_element</span>, 5, 10)
.context_click
.send_key(:arrow_down)
.send_keys(:enter)
.perform
Ref: http://www.rubydoc.info/gems/selenium-webdriver/Selenium/WebDriver/ActionBuilder