【问题标题】:Selenium Grid Hub/Crash when invoking WIN10 ChromeOption调用 WIN10 ChromeOption 时 Selenium Grid Hub/崩溃
【发布时间】:2020-09-17 20:34:59
【问题描述】:

我有一个 Selenium hub,基于平台注册了 6 个节点,如下所示:

  • 3平台为WIN10

    Capabilities {browserName: chrome, extension.sikuliCapability: true, maxInstances: 7, platform: WIN10, platformName: WIN10, seleniumProtocol: WebDriver, server:CONFIG_UUID: ae7939e1-25ff-4030-8baf-efe..., version: ANY}
    
  • VISTA 3 平台

    Capabilities {browserName: chrome, extension.sikuliCapability: true, maxInstances: 7, platform: VISTA, platformName: VISTA, seleniumProtocol: WebDriver, server:..., version: ANY}
    

有没有办法通过提及操作系统名称来调用平台上的 chrome 浏览器,我尝试了一些选项,但看起来 hub 随机调用驱动器而不是基于操作系统版本。

任何见解都会有所帮助。在某些情况下,当我提到带有 WIN10 的 Chrome 驱动程序时,chrome 驱动程序会崩溃,如下所示:

SessionId not found. Running the test locally?
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'scopedTarget.webDriver' defined in class path resource [application-context-web.xml]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.openqa.selenium.WebDriver]: Factory method 'getWebDriver' threw exception; nested exception is org.openqa.selenium.SessionNotCreatedException: session not created: No matching capabilities found
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info: host: '', ip: '', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_101'
Driver info: driver.version: unknown
remote stacktrace: Backtrace:
        Ordinal0 [0x00D7D383+3134339]
        Ordinal0 [0x00C6A171+2007409]
        Ordinal0 [0x00B0AEE8+569064]
        Ordinal0 [0x00AB0358+197464]
        Ordinal0 [0x00AAFDC8+196040]
        Ordinal0 [0x00AB0CB7+199863]
        Ordinal0 [0x00AB0C1D+199709]
        Ordinal0 [0x00AAEB0B+191243]
        Ordinal0 [0x00A92E77+77431]
        Ordinal0 [0x00A93E3E+81470]
        Ordinal0 [0x00A93DC9+81353]
        Ordinal0 [0x00C80CD9+2100441]
        GetHandleVerifier [0x00EEB75A+1396954]
        GetHandleVerifier [0x00EEB3D9+1396057]
        GetHandleVerifier [0x00EF7126+1444518]
        GetHandleVerifier [0x00EEBCE8+1398376]
        Ordinal0 [0x00C77F51+2064209]
        Ordinal0 [0x00C822EB+2106091]
        Ordinal0 [0x00C82411+2106385]
        Ordinal0 [0x00C949C4+2181572]
        BaseThreadInitThunk [0x77306359+25]
        RtlGetAppContainerNamedObjectPath [0x77647C24+228]
        RtlGetAppContainerNamedObjectPath [0x77647BF4+180]

Command duration or timeout: 598 milliseconds
        at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:599)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1128)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1022)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:512)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
        at org.springframework.beans.factory.support.AbstractBeanFactory$2.getObject(AbstractBeanFactory.java:345)
        at <packagename>.ThreadScope.get(ThreadScope.java:28)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:340)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
        at org.springframework.aop.target.SimpleBeanTargetSource.getTarget(SimpleBeanTargetSource.java:35)
        at <packagename>.getTargetObject(PUtils.java:14)
        at <packagename>.setUp(BaseSelTestCase.java:127)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:86)
        at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:514)
        at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:215)
        at org.testng.internal.Invoker.invokeMethod(Invoker.java:589)
        at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:820)
        at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1128)
        at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:129)
        at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:112)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.openqa.selenium.WebDriver]: Factory method 'getWebDriver' threw exception; nested exception is org.openqa.selenium.SessionNotCreatedException: session not created: No matching capabilities found
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info: host: '', ip: '', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_101'
Driver info: driver.version: unknown
remote stacktrace: Backtrace:
        Ordinal0 [0x00D7D383+3134339]
        Ordinal0 [0x00C6A171+2007409]
        Ordinal0 [0x00B0AEE8+569064]
        Ordinal0 [0x00AB0358+197464]
        Ordinal0 [0x00AAFDC8+196040]
        Ordinal0 [0x00AB0CB7+199863]
        Ordinal0 [0x00AB0C1D+199709]
        Ordinal0 [0x00AAEB0B+191243]
        Ordinal0 [0x00A92E77+77431]
        Ordinal0 [0x00A93E3E+81470]
        Ordinal0 [0x00A93DC9+81353]
        Ordinal0 [0x00C80CD9+2100441]
        GetHandleVerifier [0x00EEB75A+1396954]
        GetHandleVerifier [0x00EEB3D9+1396057]
        GetHandleVerifier [0x00EF7126+1444518]
        GetHandleVerifier [0x00EEBCE8+1398376]
        Ordinal0 [0x00C77F51+2064209]
        Ordinal0 [0x00C822EB+2106091]
        Ordinal0 [0x00C82411+2106385]
        Ordinal0 [0x00C949C4+2181572]
        BaseThreadInitThunk [0x77306359+25]
        RtlGetAppContainerNamedObjectPath [0x77647C24+228]
        RtlGetAppContainerNamedObjectPath [0x77647BF4+180]

Command duration or timeout: 598 milliseconds
        at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189)
        at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588)
        ... 26 more
Caused by: org.openqa.selenium.SessionNotCreatedException: session not created: No matching capabilities found
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info: host: 'XGHSGHSG', ip: '', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_101'
Driver info: driver.version: unknown
remote stacktrace: Backtrace:
        Ordinal0 [0x00D7D383+3134339]
        Ordinal0 [0x00C6A171+2007409]
        Ordinal0 [0x00B0AEE8+569064]
        Ordinal0 [0x00AB0358+197464]
        Ordinal0 [0x00AAFDC8+196040]
        Ordinal0 [0x00AB0CB7+199863]
        Ordinal0 [0x00AB0C1D+199709]
        Ordinal0 [0x00AAEB0B+191243]
        Ordinal0 [0x00A92E77+77431]
        Ordinal0 [0x00A93E3E+81470]
        Ordinal0 [0x00A93DC9+81353]
        Ordinal0 [0x00C80CD9+2100441]
        GetHandleVerifier [0x00EEB75A+1396954]
        GetHandleVerifier [0x00EEB3D9+1396057]
        GetHandleVerifier [0x00EF7126+1444518]
        GetHandleVerifier [0x00EEBCE8+1398376]
        Ordinal0 [0x00C77F51+2064209]
        Ordinal0 [0x00C822EB+2106091]
        Ordinal0 [0x00C82411+2106385]
        Ordinal0 [0x00C949C4+2181572]
        BaseThreadInitThunk [0x77306359+25]
        RtlGetAppContainerNamedObjectPath [0x77647C24+228]
        RtlGetAppContainerNamedObjectPath [0x77647BF4+180]

节点注册如下:

{
  "capabilities":
  [{
          "seleniumProtocol": "WebDriver",
          "browserName": "firefox",
          "maxInstances": 4,
          "version": "ANY",
          "platform": "WIN10",
          "firefox_binary":"C:\\Program Files\\Mozilla Firefox\\firefox.exe",
          "extension.sikuliCapability": true
        },
        {
          "seleniumProtocol": "WebDriver",
          "browserName": "chrome",
          "maxInstances": 7,
          "version": "ANY",
          "platform": "WIN10"
        },
        {
          "seleniumProtocol": "WebDriver",
          "browserName": "internet explorer",
          "maxInstances": 1,
          "version": "11",
          "platform": "WIN10"
        },
        {
          "seleniumProtocol": "WebDriver",
          "browserName": "MicrosoftEdge",
          "maxInstances": 1,
          "version": "ANY",
          "platform": "WIN10"
    }
  ],
  "proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
  "maxSession": 7,
  "port": 5555,
  "register": true,
  "registerCycle": 5000,
  "hub": "http://hubname:4444/hub/wd/",
  "nodeStatusCheckTimeout": 5000,
  "nodePolling": 5000,
  "role": "node",
  "unregisterIfStillDownAfter": 60000,
  "downPollingLimit": 2,
  "debug": false,
}

{
  "capabilities":
  [{
    "seleniumProtocol": "WebDriver",
    "browserName": "firefox",
    "maxInstances": 4,
    "version": "ANY",
    "marionette":true,
    "platform": "VISTA",
    "platformName": "VISTA",
    "firefox_binary":"C:\\Program Files\\Mozilla Firefox\\firefox.exe",
    "extension.sikuliCapability": true
  },
    {
      "seleniumProtocol": "WebDriver",
      "browserName": "chrome",
      "maxInstances": 7,
      "version": "ANY",
      "platform": "VISTA",
      "extension.sikuliCapability": true
    }
  ],
  "proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
  "maxSession": 7,
  "port": 5555,
  "register": true,
  "registerCycle": 5000,
  "hub": "http://callisto.quiacorp.com:4444/hub/wd/",
  "nodeStatusCheckTimeout": 5000,
  "nodePolling": 5000,
  "role": "node",
  "unregisterIfStillDownAfter": 60000,
  "downPollingLimit": 2,
  "debug": false,
  "servlets" : ["io.sterodium.extensions.node.SikuliExtensionServlet","io.sterodium.extensions.node.upload.FileUploadServlet","io.sterodium.extensions.node.download.FileDownloadServlet"],
  "withoutServlets": [],
  "custom": {}
}

如果能提供解决问题的任何帮助,我们将不胜感激。

【问题讨论】:

    标签: java selenium google-chrome selenium-chromedriver selenium-grid


    【解决方案1】:

    此错误消息...

    SessionId not found. Running the test locally?
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'scopedTarget.webDriver' defined in class path resource [application-context-web.xml]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.openqa.selenium.WebDriver]: Factory method 'getWebDriver' threw exception; nested exception is org.openqa.selenium.SessionNotCreatedException: session not created: No matching capabilities found
    Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
    System info: host: '', ip: '', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_101'
    Driver info: driver.version: unknown
    

    ...暗示 ChromeDriver 无法与 Browsing Context 通信,即 WIN10 上的 Browser 会话。

    您的主要问题是您使用的二进制文件版本之间的不兼容性,如下所示:

    • 虽然您使用的是 Selenium 版本:'3.141.59'
    • 你的 java.version: '1.8.0_101' 古老而古老。

    解决方案

    确保:

    【讨论】:

    • 我尝试使用 JDK 11,但我仍然在线程“main”org.openqa.selenium.SessionNotCreatedException 中看到此 WIN10 异常:未创建会话:未找到匹配功能构建信息:版本:'3.141。 59',修订:'e82be7d358',时间:'2018-11-14T08:25:53' 系统信息:主机:'',ip:'',os.name:'Windows 10',os.arch:'amd64 ', os.version: '10.0', java.version: '11.0.7' 驱动程序信息: driver.version: 未知远程堆栈跟踪: Backtrace: Ordinal0 [0x008CD383+3134339] Ordinal0 [0x007BA171+2007409] Ordinal0 [0x0065AEE8+569064]序数0 [0x00600358+197464]
    猜你喜欢
    • 1970-01-01
    • 2011-10-03
    • 2020-09-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-02-22
    • 2016-02-11
    相关资源
    最近更新 更多