Selenium: When using FirefoxDriver+geckodriver, Action.mouseMoveTo() thows an UnsupportedCommandException

Created on 8 Sep 2017  路  19Comments  路  Source: SeleniumHQ/selenium

Meta -

OS:
OpenSUSE Linux 42.2 64-bit
Selenium Version:
3.5.3
Browser:
Firefox 52.3.0 ESR
GeckoDriver Version:
18

Expected Behavior -

When FirefoxDriver is created with a geckodriver specified, and mouseMoveTo() eventually called on a WebElement, it works as expected, without throwing an exception

Actual Behavior -

UnsupportedCommandException thrown

Steps to reproduce -

In Java, first create a FirefoxDriver, and open a URL:

System.setProperty("webdriver.gecko.driver", "/tmp/geckodriver");
RemoteWebDriver driver = new FirefoxDriver();
driver.get("https://github.com/SeleniumHQ");

then call moveToElement:

WebElement elm = driver.findElement(By.xpath("//a[contains(@href, '/SeleniumHQ')]"));
Actions actions = new Actions(driver);
actions.moveToElement(elm).perform();

Note that I found this issue:

"UnsupportedCommandException mouseMoveTo with 3.4 on firefox with geckodriver 0.16.1 #4008"

which would at first seem to be the same, but it was closed by jimevans as being the same as

"Grid does not handle w3c capabilities correctly #3808"

but #3808 is ALSO closed, with the apparent fix/workaround of adding "-enablePassThrough true" to the Java command-line invocation of a standalone Selenium server.

Well, I'm not using Grid or a standalone Selenium server, so how do I pass this option? Why is #3808 closed when as of Selenium v3.5.3, I'm still hitting the issue? Is there a way to set "enablePassThrough" in the DesiredCapabilities when I call the constructor for FirefoxDriver?

Note, I'm using the geckodriver with FirefoxDriver, not the legacy mode, and I don't want to use the legacy mode as I want to support FF 55+. Is FirefoxDriver no longer supported? As recently as 10 days ago, someone has been tweaking the FirefoxDriver.java source, so it doesn't look like it's dead.

C-java D-firefox R-awaiting answer

Most helpful comment

We are facing the same issue of "UnsupportedCommandException: mouseMoveTo" with FF59.1 on Saucelab and latest Selenium 3.12.0. Does any body know how to overcome this using JavaScript ?

All 19 comments

Please show the complete exception stack trace, or even better, the complete execution log.

The stack trace is just the trace of Actions.perform() failing, but I've attached it, as part of the log from the Eclipse console:

mouseMoveTo.crash.txt

The top-level stack trace line is just the perform() call I showed above:
actions.moveToElement(elm).perform();

According to the log, you're trying to run Firefox ESR 52 with geckodriver 0.18.
This version of geckodriver requires Firefox 53+

Why did you close it without giving me a chance to respond!?

I tried it with Firefox 55 and the same thing happens. Please reopen it.

Please attach the correct log.

This is the log/trace when using the default Firefox on the system, 55.0.1. Everything else is the same.

mouseMoveTo.crash-2.txt

Thanks! But it's still unclear what's happening :(

Please run the driver with increased log level:

RemoteWebDriver driver = new FirefoxDriver(new FirefoxOptions().setLogLevel(Level.DEBUG));

and attach the detailed log here.

Also it's weird that the exception message contains no version information:
Build info: version: 'unknown', revision: 'unknown', time: 'unknown'

Where did you download Selenium library? How do you start your scenario, what's the classpath?

I'm using the official 3.5.3 zips (sha1 below) downloaded from the Selenium website:

ea157660d421c63b71bba4d6fdd2bc0009a80e2  selenium-server-3.5.3.zip
e88e5436fcd36a88d5611f2441db473eccbbf4a  selenium-java-3.5.3.zip

I expanded them, and then simply added the two main JARs and the dependent JARs under lib to the eclipse classpath, though I did rename the two top level JARs - but if that were a problem I don't think I would've gotten very far.

Could the reported error result from not being able to find a JAR? Seems like that would normally cause a different sort of exception.

No, the exception is not related to missing JARs, I just wonder why there is no version info, but it's a different issue.

OK, it looks like this happening because I'm passing my own FirefoxDriver wrapper into the Actions() constructor, an approach which worked fine in Selenium v2.53. I have my own class, let's call it MyFirefoxDriver, that implements the WebDriver interface, and contains the "real" FirefoxDriver as a member. I do this so I can reimplement findElement() as I want - most of the other APIs are just passed through to the "real" FirefoxDriver member.

Can you see any way that implementing my own WebDriver object based on FirefoxDriver, and passing it to Actions() would lead to Actions throwing an UnsupportedCommandException? Is Actions somehow assuming WebDriver is a RemoteWebDriver or something beyond the public WebDriver interface?

I guess I may have to debug this line-by-line. :-(

Make your wrapper implement org.openqa.selenium.interactions.Interactive interface and delegate two new methods to the underlying driver. This interface is required for W3C-conformant drivers (that FirefoxDriver is now).

Implementing Interactive seems to have resolved the issue, at least in my test case. Thanks!

In non-passthrough mode the actions API (using geckodriver) is still not working.

@shs96c mentioned that the non-passthrough mode should work too.
https://github.com/SeleniumHQ/selenium/issues/3808#issuecomment-329880341

Should there be a new defect for fixing non-passthrough for W3C?

@gwtuser , Good to know that the issue for you is resolved,
Could you please provide the code sample how you Implemented Interactive,
and how did you made working moveToElement or any mouse related actions, i struck with the below issue still.

org.openqa.selenium.UnsupportedCommandException: mouseMoveTo
Build info: version: '3.4.0', revision: 'unknown', time: 'unknown'
System info: host: 'WIN-R1JBAO1CNPS', ip: '10.100.20.46', os.name: 'Windows Server 2008 R2', os.arch: 'x86', os.version: '6.1', java.version: '1.8.0_91'
Driver info: driver.version: RemoteWebDriver
Command duration or timeout: 0 milliseconds

Note:- Im running on sauce lab
driver = new RemoteWebDriver(new URL("http://"+"username"+":"+"api_key"+"@ondemand.saucelabs.com:80/wd/hub"),caps);

@sudheergv were you able to solve the issue you mentioned. I do face this issue for saucelab run.

This is still not working with SELENIUM GRID 3.8.1, but works if I am running tests on local.

Tried passing "-enablePassThrough false" to the grid, but no luck.

We are facing the same issue of "UnsupportedCommandException: mouseMoveTo" with FF59.1 on Saucelab and latest Selenium 3.12.0. Does any body know how to overcome this using JavaScript ?

For those of you that experience this issue on SauceLabs, here's how to fix it:

Updating your test code to W3C capabilities will fix this issue. Information on this can be found here:
https://wiki.saucelabs.com/display/DOCS/Selenium+W3C+Capabilities+Support+-+Beta

There is a YouTube video on this page that is helpful in walking you through what is needed for a Java test.

Was this page helpful?
0 / 5 - 0 ratings