1

Running the Selenium Action class perform method throws " org.openqa.selenium.UnsupportedCommandException:" on eclipse. Can anyone advise on how to resolve it.

This is the code

package secondpackage;

import org.openqa.selenium.*;
import org.openqa.selenium.firefox.FirefoxDriver;

import org.openqa.selenium.interactions.Action;
import org.openqa.selenium.interactions.Actions;

public class MyTest {

public static void main(String[] args) {
String baseUrl = "http://newtours.demoaut.com/";
        WebDriver driver;
        System.setProperty("webdriver.gecko.driver", "C:\\Users\\xxx\\Documents\\geckodriver.exe");
        driver = new FirefoxDriver();

        driver.get(baseUrl);           
        WebElement link_Home = driver.findElement(By.linkText("Home"));
        WebElement td_Home = driver
                .findElement(By
                .xpath("//html/body/div"
                + "/table/tbody/tr/td"
                + "/table/tbody/tr/td"
                + "/table/tbody/tr/td"
                + "/table/tbody/tr"));    

        Actions builder = new Actions(driver);
        Action mouseOverHome = builder
                .moveToElement(link_Home)
                .build();

        String bgColor = td_Home.getCssValue("background-color");
        System.out.println("Before hover: " + bgColor);        
        **mouseOverHome.perform();**        
        bgColor = td_Home.getCssValue("background-color");
        System.out.println("After hover: " + bgColor);
        driver.quit();
}
}

This is console log:

1487695499339   geckodriver INFO    Listening on 127.0.0.1:2786
Feb 21, 2017 5:44:59 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Attempting bi-dialect session, assuming Postel's Law holds true on the remote end
1487695500651   mozprofile::profile INFO    Using profile path C:\Users\ikenna\AppData\Local\Temp\rust_mozprofile.DJOOcSkDuPdH
1487695500754   geckodriver::marionette INFO    Starting browser C:\Program Files (x86)\Mozilla Firefox\firefox.exe
1487695500923   geckodriver::marionette INFO    Connecting to Marionette on localhost:62601
1487695520078   Marionette  INFO    Listening on port 62601
JavaScript error: about:blank line 4 > eval, line 1: ReferenceError: gBrowser is not defined
Feb 21, 2017 5:45:34 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: W3C
Before hover: rgb(255, 165, 0)
Exception in thread "main" org.openqa.selenium.UnsupportedCommandException: POST /session/be1883b8-da2a-401a-bcaa-5b73650a52b7/moveto did not match a known command
Build info: version: 'unknown', revision: '1969d75', time: '2016-10-18 09:43:45 -0700'
System info: host: 'ikenna-PC', ip: '192.168.1.120', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_111'
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Capabilities [{rotatable=false, raisesAccessibilityExceptions=false, marionette=true, firefoxOptions={args=[], prefs={}}, appBuildId=20170125094131, version=, platform=XP, proxy={}, command_id=1, specificationLevel=0, acceptSslCerts=false, processId=7940, browserVersion=51.0.1, platformVersion=6.1, XULappId={ec8030f7-c20a-464f-9b0e-13a3a9e97384}, browserName=firefox, takesScreenshot=true, takesElementScreenshot=true, platformName=windows_nt}]
Session ID: be1883b8-da2a-401a-bcaa-5b73650a52b7
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:127)
    at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:93)
    at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:42)
    at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:163)
    at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:82)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:601)
    at org.openqa.selenium.remote.RemoteExecuteMethod.execute(RemoteExecuteMethod.java:35)
    at org.openqa.selenium.remote.RemoteMouse.mouseMove(RemoteMouse.java:89)
    at org.openqa.selenium.interactions.MoveMouseAction.perform(MoveMouseAction.java:39)
    at org.openqa.selenium.interactions.CompositeAction.perform(CompositeAction.java:50)
    at secondpackage.MyTest.main(MyTest.java:34)

I am using selenium 3.0.1 driver on firefox 51.0.1.

1

It has not been implemented in the Gecko/Marinette driver yet.

Track the status of the implementation:

https://bugzilla.mozilla.org/show_bug.cgi?id=1292178 https://github.com/mozilla/geckodriver/issues/159

As a work around, you can do most things with the JavascriptExecutor: https://seleniumhq.github.io/selenium/docs/api/java/org/openqa/selenium/JavascriptExecutor.html

  • Also, in my own testing I get a NotImplementedExcecption with Safari and WebDriverWait. I haven't found a ticket for that, though. – kirbycope Feb 21 '17 at 20:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.