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

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

我有一个场景,我必须将鼠标悬停在菜单 link 上,然后单击下拉子菜单。我使用的代码如下:

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);
    }

但是当我 运行 这段代码时,它失败并显示一条错误消息:-

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

我也尝试了下面提到的代码,但没有成功,并且出现了同样的错误。

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

我正在使用 webdriver v2.53 并在 FF v47.0.1 上使用 运行。

作为 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 而不是 Selenium。

Selenium 表示他们将为操作提供 Selenium-to-W3C-WebDriver 垫片,但这可能需要一些时间才能在我们完成实施后生成。 geckodriver/Marionette 中的实施尚未开始。


mentioned here from v0.12.0 of geckodriver, Implemented routing for new actions API一样,但在Marionette

中也未完全实现

你应该升级你的geckodriver