Selenium remoteWebDriver(& SauceLabs)Firefox moseMoveTo动作异常

时间:2017-07-25 16:53:43

标签: python selenium firefox saucelabs remotewebdriver

使用SauceLabs中的任何可用操作系统通过Selenium(3.4.0)和Python绑定(3.4.3)对Firefox进行简单的悬停测试(Linux除外,最新的Firefox版本太旧),通过执行以下ActionChain:

hover = ActionChains(driver)
hover.move_to_element(elm_Men_Menu).perform()

它会抛出以下错误:

Taceback:

File [...] in testHover
hover.perform()
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/common/action_chains.py", line 80, in perform
action()
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/common/action_chains.py", line 290, in <lambda>
                                                                                                              Command.MOVE_TO, {'element': to_element.id}))
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 256, in execute
self.error_handler.check_response(response)
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/errorhandler.py", line 194, in check_response
raise exception_class(message, screen, stacktrace)
WebDriverException: Message: mouseMoveTo
Build info: version: '3.4.0', revision: 'unknown', time: 'unknown'
System info: host: 'itako44164.prod.miso', ip: '[...]', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.12.1', java.version: '1.8.0_112'
Driver info: driver.version: RemoteWebDriver
Stacktrace:
at org.openqa.selenium.remote.http.AbstractHttpCommandCodec.encode (AbstractHttpCommandCodec.java:220)
at org.openqa.selenium.remote.http.AbstractHttpCommandCodec.encode (AbstractHttpCommandCodec.java:118)
at org.openqa.selenium.remote.HttpCommandExecutor.execute (HttpCommandExecutor.java:158)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute (DriverCommandExecutor.java:82)
at org.openqa.selenium.remote.RemoteWebDriver.execute (RemoteWebDriver.java:637)
at org.openqa.selenium.remote.RemoteExecuteMethod.execute (RemoteExecuteMethod.java:35)
at org.openqa.selenium.remote.RemoteMouse.mouseMove (RemoteMouse.java:89)
at org.openqa.selenium.support.events.internal.EventFiringMouse.mouseMove (EventFiringMouse.java:58)
at org.openqa.selenium.remote.server.handler.interactions.MouseMoveToLocation.call (MouseMoveToLocation.java:59)
at org.openqa.selenium.remote.server.handler.interactions.MouseMoveToLocation.call (MouseMoveToLocation.java:32)
at java.util.concurrent.FutureTask.run (FutureTask.java:266)
at org.openqa.selenium.remote.server.DefaultSession$1.run (DefaultSession.java:176)
at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:617)
at java.lang.Thread.run (Thread.java:745)

在当地它完美无缺。我是使用geckodriver 0.17.0和Selenium 3.4.3(编辑过的)。这是之前报道的Selenium中的错误,但它是针对Selenium 3.x和geckodriver 0.15.0(https://github.com/SeleniumHQ/selenium/issues/2285)解决的。对于SauceLabs测试我使用Selenium 3.4.0(可以在错误报告中看到)和SauceLabs文档中,对于Firefox 53及更高版本,使用了geckodriver 0.16.0(https://wiki.saucelabs.com/display/DOCS/Test+Configuration+Options#TestConfigurationOptions-SeleniumVersion),其中,原则上,应该支持move_to_element()动作。

我做错了吗?有没有办法指定geckodriver版本?到目前为止,所需的功能如下所示:

desired_cap = {
  'platform':"Mac OS X 10.12",
  'browserName':"firefox",
  'version':"54",
  'seleniumVersion':"3.4.0",
}

编辑1 :我没有提及它,但它适用于Chrome和IE11

编辑2 :在Linux中使用selenium独立服务器(3.4.0)在本地执行代码时会出现同样的问题。 geckodriver版本是0.17.0。除了System info: host:

之外,完全相同的回溯

1 个答案:

答案 0 :(得分:0)

解决:

Selenium已经意识到了这个问题:

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

它已经解决,将在3.5版本中提供:

https://github.com/SeleniumHQ/selenium/issues/3808#issuecomment-311105917

现在可以解决克隆主存储库,构建自己的selenium服务器并使用-enablePassThrough标志启动节点