0

java.version: '12.0.1'

硒服务器构建信息:版本:'3.141.59'

火狐版本 = 68

python 版本 = Python 3.7.2

我尝试在 selenium 网格上运行 firefox 并收到以下错误:selenium.common.exceptions.SessionNotCreatedException:消息:无法找到一组匹配的功能构建信息:版本:'3.141.59',修订:'e82be7d358',时间: '2018-11-14T08:25:53' 系统信息:主机:'*****',ip:'******',os.name:'Windows 8.1',os.arch:'amd64 ',os.version:'6.3',java.version:'12.0.1' 驱动程序信息:driver.version:未知

这就是我设置网格的方式:

java -jar selenium-server-standalone-3.141.59.jar -port 4444 -role hub

在第二个 cmd 窗口上,我像这样启动 firefox 节点

java -Dwebdriver.gecko.driver=C:\Selenium\geckodriver.exe -jar selenium-server-standalone-3.141.59.jar -port 5557 -role node -browser "browserName=firefox,platform=WINDOWS,maxInstances=1"

我尝试了几种功能选项的组合,包括使用 json 文件(功能列表)和我的 python 脚本中更详细的功能选项来设置 firefox 节点,但我仍然遇到相同的错误。

这是我的python脚本代码:

from selenium import webdriver
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities

cap = DesiredCapabilities.FIREFOX.copy()

cap['browserName'] = 'firefox'
cap['platform'] = "WINDOWS"

driver = webdriver.Remote(command_executor='http://localhost:4444/wd/hub',
                          desired_capabilities=cap)
driver.get("https://www.google.co.in/")
print(driver.title)
driver.quit()

我在我的 cmd 窗口上也收到这样的远程堆栈跟踪错误:

remote stacktrace: 
Stacktrace:
    at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0 (NativeConstructorAccessorImpl.java:-2)
    at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance (NativeConstructorAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance (DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstanceWithCaller (Constructor.java:500)
    at java.lang.reflect.Constructor.newInstance (Constructor.java:481)
    at org.openqa.selenium.remote.W3CHandshakeResponse.lambda$errorHandler$0 (W3CHandshakeResponse.java:62)
    at org.openqa.selenium.remote.HandshakeResponse.lambda$getResponseFunction$0 (HandshakeResponse.java:30)
    at org.openqa.selenium.remote.ProtocolHandshake.lambda$createSession$0 (ProtocolHandshake.java:126)
    at java.util.stream.ReferencePipeline$3$1.accept (ReferencePipeline.java:195)
at java.util.Spliterators$ArraySpliterator.tryAdvance (Spliterators.java:958)
    at java.util.stream.ReferencePipeline.forEachWithCancel (ReferencePipeline.java:127)
    at java.util.stream.AbstractPipeline.copyIntoWithCancel (AbstractPipeline.java:502)
    at java.util.stream.AbstractPipeline.copyInto (AbstractPipeline.java:488)
    at java.util.stream.AbstractPipeline.wrapAndCopyInto (AbstractPipeline.java:474)
    at java.util.stream.FindOps$FindOp.evaluateSequential (FindOps.java:150)
    at java.util.stream.AbstractPipeline.evaluate (AbstractPipeline.java:234)
    at java.util.stream.ReferencePipeline.findFirst (ReferencePipeline.java:543)
    at org.openqa.selenium.remote.ProtocolHandshake.createSession (ProtocolHandshake.java:128)
    at org.openqa.selenium.remote.ProtocolHandshake.createSession (ProtocolHandshake.java:74)
    at org.openqa.selenium.grid.session.remote.RemoteSession$Factory.performHandshake (RemoteSession.java:147)
    at org.openqa.selenium.grid.session.remote.ServicedSession$Factory.apply (ServicedSession.java:161)
    at org.openqa.selenium.remote.server.ActiveSessionFactory.lambda$apply$12 (ActiveSessionFactory.java:180)
    at java.util.stream.ReferencePipeline$3$1.accept (ReferencePipeline.java:195)
    at java.util.stream.ReferencePipeline$11$1.accept (ReferencePipeline.java:442)
    at java.util.stream.ReferencePipeline$2$1.accept (ReferencePipeline.java:177)
    at java.util.Spliterators$ArraySpliterator.tryAdvance (Spliterators.java:958)

这很长...如果需要,我可以将其余部分附加到问题中...

4

1 回答 1

0

我建议降级到 Java 8 并为您的节点使用 config.json 文件,如下所示:

 {
   "capabilities": [
      {
       "browserName": "firefox",
       "platform": "WIN7",
       "maxInstances": 5
      }
   ],
   "hub": "http://<hub ip>:<hub port>"
  }
于 2019-07-23T18:16:48.363 回答