Selenium Actions.movetoElement - org.openqa.selenium.UnsupportedCommandException

元气小坏坏 提交于 2019-12-24 07:49:35

问题


I have a scenario where I have to hover over a menu link and click on the drop down sub menus. The code that I'm using is below:

public void changeLanguageTest() throws InterruptedException
    {
        WebElement LanguageMenu = driver.findElement(By.cssSelector(".change-language>button"));
        action.moveToElement(LanguageMenu);
        WebElement mongolianLang = driver.findElement(By.cssSelector(".change-language>ol>li:nth-child(3)>a"));
        action.moveToElement(mongolianLang).click().build().perform();
        Thread.sleep(3000L);
    }

But when I run this code, It fails with an error message :-

org.openqa.selenium.UnsupportedCommandException: POST /session/3077f893-d9ab-487d-b09f-c5bcd135ea31/moveto did not match a known command

I tried below mentioned code too but no success and same error occurred.

BaseClass.action.moveToElement(LanguageMenu).moveToElement(mongolianLang).click().build().perform();

I'm using webdriver v2.53 and running it on FF v47.0.1.


回答1:


As a bug logged here geckodriver does not yet implement actions. The actions we will implement are those being defined right now in the W3C WebDriver standard and not those of Selenium.

Selenium has said they will provide a Selenium-to-W3C-WebDriver shim for actions, but this may take some time to produce after we have made our implementation. Implementation in geckodriver/Marionette has not yet started.


As mentioned here from v0.12.0 of geckodriver, Implemented routing for new actions API, but it too is not yet fully implemented in Marionette


You should upgrade your geckodriver.



来源:https://stackoverflow.com/questions/42197200/selenium-actions-movetoelement-org-openqa-selenium-unsupportedcommandexception

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!