Monika Yadav Monika Yadav - 1 year ago 114
Java Question

Select an Option from the Right-Click Menu in Selenium Webdriver - Java

I am using Selenium webdriver. I am not able to select (say 2nd) option from the Options opened on right click.

In my current code I am able to right click on webElement but could not select an Option from the list that is opened after right click, as it disappears automatically.

Actions action= new Actions(driver);

So with this code I am able to right click but the right click menu automatically disappears. I want to select say 2nd Option from Right click menu.

Please Help!!!

Answer Source

To select the item from the contextual menu, you have to just move your mouse positions with the use of Key down event like this:-

Actions action= new Actions(driver);

hope this will works for you. Have a great day :)

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download