简体   繁体   English

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

[英]Mouse hover not working for Firefox browser using Selenium webdriver

Below are the firefox, gecko driver and selenium versions that I have used for automation scripts: Firefox browser: 52.0 Selenium: 3.0.1 Gecko driver: 0.11.1 以下是我用于自动化脚本的firefox,gecko驱动程序和selenium版本:Firefox浏览器:52.0 selenium:3.0.1 gecko驱动程序:0.11.1

Below is my code for mouse hover action: 以下是我的鼠标悬停操作代码:

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

This code had worked properly for chrome and IE browser and facing issue only in Firefox. 此代码对于chrome和IE浏览器正常运行,并且仅在Firefox中面临问题。 I have tried by upgrading Selenium and Gecko driver, but the that time the browser did not invoke. 我已经尝试通过升级Selenium和Gecko驱动程序,但是那个时候浏览器没有调用。 Below is the error message that is being displayed 下面是正在显示的错误信息

POST /session/dee48bec-9a8a-4ae7-92a3-f8fcbd218f5a/moveto did not match a known command Build info: version: '2.42.2', revision: '6a6995d31c7c56c340d6f45a76976d43506cd6cc', time: '2014-06-03 10:52:47' System info: host: 'PC189896', ip: '10.243.169.86', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_141' Driver info: org.openqa.selenium.firefox.FirefoxDriver Capabilities [{moz:profile=C:\\Users\\313772\\AppData\\Local\\Temp\\rust_mozprofile.2bNvQAYH4V01, rotatable=false, timeouts={implicit=0, page load=300000, script=30000}, pageLoadStrategy=normal, platform=ANY, specificationLevel=0, moz:accessibilityChecks=false, acceptInsecureCerts=true, browserVersion=52.0.1, platformVersion=6.1, moz:processID=11216, browserName=firefox, platformName=windows_nt}] Session ID: dee48bec-9a8a-4ae7-92a3-f8fcbd218f5a POST / session / dee48bec-9a8a-4ae7-92a3-f8fcbd218f5a / moveto与已知命令不匹配Build info:版本:'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,rotatable = false,超时= {implicit = 0,页面加载= 300000,脚本= 30000},页面加载策略=正常,平台=任何,specificationLevel = 0,moz:accessibilityChecks =否,acceptInsecureCerts = true,浏览器版本= 52.0.1,平台版本= 6.1,moz:进程ID = 11216,浏览器名称= firefox,platformName = windows_nt}]会话ID:dee48bec-9a8a-4ae7-92a3-f8fcbd218f5a

Please help. 请帮忙。

Looks like the /{session id}/moveto endpoint isn't supported by geckodriver. 看起来/{session id}/moveto eckedriver不支持/{session id}/moveto端点。 There is a discussion about this here and a bug report was already filed against Selenium here . 有一个关于这个的讨论在这里和bug报告已经提出了对硒这里

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM