Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting Error while running moveToElement() method in selenium webdriver? [duplicate]

I'm pretty new to selenium and when i'm running code below for Selenium WebDriver in Eclipse (Java), i'm getting this exception:

"Exception in thread "main" org.openqa.selenium.UnsupportedCommandException: mouseMoveTo"

Here is the code:

    WebDriver driver = new FirefoxDriver();
    driver.get("http://newtours.demoaut.com/");
    WebElement myElement = driver.findElement(By.cssSelector("input[name=userName]"));

    Actions myAction = new Actions(driver);
    myAction.moveToElement(myElement)
        .click()
        .keyDown(myElement, keys.SHIFT)
        .sendKeys(myElement, "test")
        .keysUp(myElement, keys.SHIFT)
        .(myElement)
        .contextClick()
        .build()
        .perform();

What causes this error?

Thanks and regards.

like image 862
Rishabh Jain Avatar asked Mar 01 '17 12:03

Rishabh Jain


1 Answers

There is a known issue with the new Version of the FirefoxDriver namely the GeckoDriver, which doesn´t support the Action class see:

Selenium web driver moveToElement (Actions) throwing error with marionette driver?

https://github.com/SeleniumHQ/selenium/issues/3348

Without more info I´d assume this is also your problem. If you need to test with FF then use an older version or Chrome with the ChromeDriver

like image 174
Enrique Castaneda Avatar answered Sep 27 '22 23:09

Enrique Castaneda