I am using Selenium 2 (Web Driver) under Linux with a FireFoxDriver.
I am not able to perform a right click on a WebElement or on another possition using coordinates. I also cannot move the mouse pointer.
I have tried to use the "Actions" object:
Actions actions = new Actions(ffDriver);
WebElement we = ffDriver.findElement(By.linkText("WhatEver"))
actions.contextClick(we).build().perform();
I also have tried to use the "Mouse" object:
Mouse mouse = ((HasInputDevices)ffDriver).getMouse();
mouse.contextClick(we.getCoordinates());
These codes don't fail but they don't do anything.
However, if I perform a regular click in the two examples above, it works as expected.
Do anybody know what is the problem with this?
Thank you.
Finally I understood the issue.
On Selenium 2, the "contextClick" function over a web element does not simulate a right click into that element, it just activate the "onContextMenu()" event placed in the HTML code of the element.
So, if you want to access to that kind of context menus, it should be handled on the HTML code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With