鼠标悬停不适用于使用Selenium webdriver的Firefox浏览器

时间:2017-12-15 12:29:20

标签: java selenium-webdriver geckodriver

以下是我用于自动化脚本的firefox,gecko驱动程序和selenium版本: Firefox浏览器:52.0 硒:3.0.1 壁虎司机:0.11.1

以下是我的鼠标悬停操作代码:

Actions action = new Actions(driver.getWebDriver());
WebElement mainMenu = driver.findElement(By.xpath("(//*[@class='ciebar__menu-item ciebar__menu-item--has-dropdown medium-4 '])[1]/a"));
WebElement submenuxpath = driver.findElement(By.xpath("(//*[@class='ciebar__menu-item ciebar__menu-item--has-dropdown medium-4 '])[1]/ul/li[1]/a"));
action.moveToElement(mainMenu).moveToElement(submenuxpath).click().build().perform();

此代码适用于chrome和IE浏览器,仅在Firefox中面临问题。我试过通过升级Selenium和Gecko驱动程序,但那次浏览器没有调用。以下是正在显示的错误消息

  

POST / session / dee48bec-9a8a-4ae7-92a3-f8fcbd218f5a / moveto与已知命令不匹配构建信息:版本:'2.42.2',修订版:'6a6995d31c7c56c340d6f45a76976d43506cd6cc',时间:'2014-06-03 10 :52:47'系统信息:主机:'PC189896',ip:'10 .243.169.86',os.name:'Windows 7',os.arch:'amd64',os.version:'6.1',java.version :'1.8.0_141'驱动程序信息:org.openqa.selenium.firefox.FirefoxDriver功能[{moz:profile = C:\ Users \ 313772 \ AppData \ Local \ Temp \ rust_mozprofile.2bNvQAYH4V01,rotate = false,timeouts = {implicit = 0,页面加载= 300000,脚本= 30000},pageLoadStrategy =正常,platform = ANY,specificationLevel = 0,moz:accessibilityChecks = false,acceptInsecureCerts = true,browserVersion = 52.0.1,platformVersion = 6.1,moz:processID = 11216 ,browserName = firefox,platformName = windows_nt}]会话ID:dee48bec-9a8a-4ae7-92a3-f8fcbd218f5a

请帮忙。

1 个答案:

答案 0 :(得分:0)

看起来geckodriver不支持/{session id}/moveto端点。有关此here的讨论,已经针对Selenium here提交了错误报告。