Select option from context click menu in Chrome

532 views
Skip to first unread message

Federico Grasso

unread,
Jan 19, 2016, 10:29:50 PM1/19/16
to Selenium Users

I'm facing an issue in Chrome 47, using Selenium (WebDriver) 2.48.2, ChromeDriver 2.20.353145, and Java as programming language. I couldn't find any solutions online. I need to open the "right click menu of browser" (or context click menu) from an input and I could do this using this code:

new Actions(driverExample).contextClick(inputExample).build().perform();

So the next step: select an option from it. I searched online and it seemed simple, but it's not. I didn't try on others browsers, but I always saw online that many people did this in Firefox and Internet Explorer using something like:

new Actions(driverExample).contextClick(inputExample).sendKeys(Keys.ARROW_UP).sendKeys(Keys.ARROW_UP).sendKeys(Keys.RETURN).build().perform();

In this situation I put two "arrow up" and one "enter", because I have to select the second option from the bottom. Anyway, this seems to work for people in Firefox and Internet Explorer, but not on Chrome and I also saw few discussions about this problem without solution. So why not give to me and the others a final solution here? Thanks in advance.

murali seleniumtrainer

unread,
Jan 21, 2016, 5:11:51 AM1/21/16
to Selenium Users
Hi,

Once after context click, are you not able to click on required option. I mean just performing normal click with location instead of keys?

if normal click is not working, then try like below
new Actions(driverExample).contextClick(inputExample).moveByOffset(5,30).click().build().perform();

i am expecting y-axis = 30 moves up to second option.


Thank You,
Murali

Pooja Gadekar

unread,
Nov 15, 2017, 7:23:11 AM11/15/17
to Selenium Users
Hi Federico Grasso,

Any solution you found for "Select option from context click menu in Chrome" because above solution not working for chrome browser.

Thanks & Regards,
Pooja G

On Wednesday, January 20, 2016 at 8:59:50 AM UTC+5:30, Federico Grasso wrote:
Reply all
Reply to author
Forward
0 new messages