Selenium Grid无法转发请求连接到节点

时间:2015-06-17 16:38:42

标签: selenium selenium-grid

我真的很难设置Selenium Grid。配置如下所示:

  1. Hub - windows 7 machine
  2. Windows节点上的Chrome - 同样的Windows 7计算机
  3. Windows节点上的Firefox - 相同的Windows 7机器
  4. 即在Windows节点上 - 相同的Windows 7机器
  5. Linux节点上的Chrome - 在相同的Windows 7计算机内运行的VM
  6. Linux节点上的Firefox - 在相同的Windows 7机器内运行的VM
  7. Mac节点上的Chrome - mac mini
  8. mac节点上的Firefox - 相同的mac mini
  9. mac节点上的Safari - 相同的mac mini
  10. Web应用程序服务器 - 在相同的Windows 7计算机内运行的VM
  11. 我有一个150测试测试套件,我试图在所有节点上并行运行所有测试。在mac mini上运行的测试几乎从未结束。我收到所有三个浏览器相同的错误消息,它没有任何模式。在任何测试期间都可能发生错误。即使我只在mac mini上的一个浏览器中运行测试,它也会发生。问题永远不会发生在Windows或Linux节点上。

    错误讯息:

    org.openqa.selenium.WebDriverException: cannot forward the request Connect
    to 192.168.1.103:5555 [/192.168.1.103] failed: Connection timed out: connect
    Command duration or timeout: 21.02 seconds
    Build info: version: '2.45.0', revision: '5017cb8', time: '2015-02-26 23:59:50'
    System info: host: 'hub', ip: '192.168.56.1', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_45'
    Driver info: org.openqa.selenium.remote.RemoteWebDriver
    Capabilities [{applicationCacheEnabled=true, rotatable=false, handlesAlerts=true, databaseEnabled=true, version=38.0.5, platform=MAC, nativeEvents=false, acceptSslCerts=true, webdriver.remote.sessionid=1f7a9512-5c5b-4f52-bcd9-ca4d8f351343, webStorageEnabled=true, locationContextEnabled=true, browserName=firefox, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true}]
    Session ID: 1f7a9512-5c5b-4f52-bcd9-ca4d8f351343
    *** Element info: {Using=xpath, value=(//*[contains(concat(' ', normalize-space(@class), ' '), ' explorerWidget ')]//*[contains(concat(' ', normalize-space(@class), ' '), ' controlContentRow ')])[2]//a}
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
    at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:204)
    at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:156)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:599)
    at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:352)
    at org.openqa.selenium.remote.RemoteWebDriver.findElementByXPath(RemoteWebDriver.java:449)
    at org.openqa.selenium.By$ByXPath.findElement(By.java:357)
    at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:344)
    at sun.reflect.GeneratedMethodAccessor8.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.openqa.selenium.support.ThreadGuard$WebDriverInvocationHandler.invokeUnderlying(ThreadGuard.java:100)
    at org.openqa.selenium.support.ThreadGuard$WebDriverInvocationHandler.invoke(ThreadGuard.java:92)
    at com.sun.proxy.$Proxy9.findElement(Unknown Source)
    at org.openqa.selenium.support.ui.ExpectedConditions.findElement(ExpectedConditions.java:730)
    at org.openqa.selenium.support.ui.ExpectedConditions.access$0(ExpectedConditions.java:728)
    at org.openqa.selenium.support.ui.ExpectedConditions$3.apply(ExpectedConditions.java:106)
    at org.openqa.selenium.support.ui.ExpectedConditions$3.apply(ExpectedConditions.java:1)
    at org.openqa.selenium.support.ui.FluentWait.until(FluentWait.java:208)
    at com.altego.common.WebElements.getElementByXpath(WebElements.java:31)
    at com.altego.webactions.View.setView(View.java:41)
    at com.altego.tests.functional.DistributionViewTest.DDistributionMeasure(DistributionViewTest.java:172)
    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:497)
    at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)
    at org.testng.internal.Invoker.invokeMethod(Invoker.java:714)
    at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)
    at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)
    at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
    at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
    at org.testng.TestRunner.privateRun(TestRunner.java:767)
    at org.testng.TestRunner.run(TestRunner.java:617)
    at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
    at org.testng.SuiteRunner.access$000(SuiteRunner.java:37)
    at org.testng.SuiteRunner$SuiteWorker.run(SuiteRunner.java:368)
    at org.testng.internal.thread.ThreadUtil$2.call(ThreadUtil.java:64)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    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)
    Caused by: org.openqa.grid.common.exception.GridException: cannot forward the request Connect to 192.168.1.103:5555 [/192.168.1.103] failed: Connection timed out: connect
    at org.openqa.grid.web.servlet.handler.RequestHandler.process(RequestHandler.java:139)
    at org.openqa.grid.web.servlet.DriverServlet.process(DriverServlet.java:83)
    at org.openqa.grid.web.servlet.DriverServlet.doPost(DriverServlet.java:67)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
    at org.seleniumhq.jetty7.servlet.ServletHolder.handle(ServletHolder.java:565)
    at org.seleniumhq.jetty7.servlet.ServletHandler.doHandle(ServletHandler.java:479)
    at org.seleniumhq.jetty7.server.session.SessionHandler.doHandle(SessionHandler.java:225)
    at org.seleniumhq.jetty7.server.handler.ContextHandler.doHandle(ContextHandler.java:1031)
    at org.seleniumhq.jetty7.servlet.ServletHandler.doScope(ServletHandler.java:406)
    at org.seleniumhq.jetty7.server.session.SessionHandler.doScope(SessionHandler.java:186)
    at org.seleniumhq.jetty7.server.handler.ContextHandler.doScope(ContextHandler.java:965)
    at org.seleniumhq.jetty7.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
    at org.seleniumhq.jetty7.server.handler.HandlerWrapper.handle(HandlerWrapper.java:111)
    at org.seleniumhq.jetty7.server.Server.handle(Server.java:349)
    at org.seleniumhq.jetty7.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:452)
    at org.seleniumhq.jetty7.server.BlockingHttpConnection.handleRequest(BlockingHttpConnection.java:47)
    at org.seleniumhq.jetty7.server.AbstractHttpConnection.content(AbstractHttpConnection.java:894)
    at org.seleniumhq.jetty7.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:948)
    at org.seleniumhq.jetty7.http.HttpParser.parseNext(HttpParser.java:857)
    at org.seleniumhq.jetty7.http.HttpParser.parseAvailable(HttpParser.java:235)
    at org.seleniumhq.jetty7.server.BlockingHttpConnection.handle(BlockingHttpConnection.java:66)
    at org.seleniumhq.jetty7.server.bio.SocketConnector$ConnectorEndPoint.run(SocketConnector.java:254)
    at org.seleniumhq.jetty7.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:599)
    at org.seleniumhq.jetty7.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:534)
    at java.lang.Thread.run(Unknown Source)
    

    我不确定将代码放在这里有多大意义,因为在任何测试中都可能发生错误,但我可以保留hubConfig.json和nodeConfig.json。

    hubConfig.json

    {
      "host": null,
      "port": 4444,
      "newSessionWaitTimeout": 20000,
      "servlets" : ["org.openqa.grid.web.servlets.ResourceServlet"],
      "prioritizer": null,
      "capabilityMatcher": "org.openqa.grid.internal.utils.DefaultCapabilityMatcher",
      "throwOnCapabilityNotPresent": true,
      "nodePolling": 5000,
    
      "cleanUpCycle": 500000,
      "timeout": 3000000,
      "browserTimeout": 500000,
      "maxSession": 10,
      "jettyMaxThreads":-1
    
    } 
    

    nodeConfig.json:

    {
     "capabilities":
          [
            {
              "browserName": "firefox",
              "maxInstances": 1
            }
          ],
    "configuration":
        {
        "nodeTimeout":600000,
        "port":5555,
    
        "nodePolling":5000,
    
        "registerCycle":10000,
        "register":true,
        "cleanUpCycle":200000,
        "timeout":600000,
        "maxSession":1
        }
    }
    

    另一件可能有用的事情是,两台机器都使用无线连接连接到路由器。

    由于

0 个答案:

没有答案