Selenium Grid:RemoteWebDriver中的URL(URL,大写)

时间:2018-07-06 08:09:48

标签: selenium selenium-webdriver selenium-grid selenium-grid2

我试图使用硒网格运行测试套件,并且能够建立集线器和一个节点。此后,当我初始化RemoteWebdiver(url,caps)调用时,它将引发异常:

org.openqa.selenium.WebDriverException: Error forwarding the new session Error forwarding the request Failed to connect to <IP>:<PORT>

此外,当我ping通到该“ Node_IP”时,它也会显示100%的丢失。但是我的网格控制台显示它已连接。我已通过防火墙为端口4444添加了入站和出站规则。对于“ Node_IP”和“ PORT”(即“ 4444”),telnet命令也会失败。

当我通过http://localhost:4444/wd/hub

传递URL时,我可以在本地执行测试。

/ ****添加的说明***** /
hubConfig :java -jar selenium-server-standalone-3.13.0.jar -role hub -host“ Host_IP”
nodeConfig :java -Dwebdriver.chrome.driver =“ chrome_driver_location_on_node” -jar selenium-server-standalone-3.13.0.jar -role节点-hub http://“ host_ip”:4444 / grid /注册浏览器 “ browserName = chrome,platform = WINDOWS,version = 67.0,maxInstances = 5”

FireFox和IE也一样。
代码可以正常运行,因为我能够作为本地主机执行。

堆栈跟踪为:
仅供参考:“ Node_PORT”是随机端口。我还没有分配。我还尝试通过分配端口来尝试它,但是它也不起作用。

org.openqa.selenium.WebDriverException: Error forwarding the new session Error forwarding the request Failed to connect to /<Node_IP>:<Node_PORT>
Command duration or timeout: 51.98 seconds
Build info: version: '3.13.0', revision: '2f0d292', time: '2018-06-25T15:24:21.231Z'
System info: host: '<System_Info>', ip: <Hub_IP>, os.name: 'Windows Server 2008 R2', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_151'
Driver info: driver.version: RemoteWebDriver
    at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:214)
    at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:166)
    at org.openqa.selenium.remote.JsonWireProtocolResponse.lambda$new$0(JsonWireProtocolResponse.java:53)
    at org.openqa.selenium.remote.JsonWireProtocolResponse.lambda$getResponseFunction$2(JsonWireProtocolResponse.java:91)
    at org.openqa.selenium.remote.ProtocolHandshake.lambda$createSession$0(ProtocolHandshake.java:123)
    at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
    at java.util.Spliterators$ArraySpliterator.tryAdvance(Spliterators.java:958)
    at java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:126)
    at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:498)
    at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:485)
    at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
    at java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:152)
    at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
    at java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:464)
    at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:126)
    at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:73)
    at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:136)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:548)
    at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:212)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:130)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:143)
    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.openqa.grid.common.exception.GridException: Error forwarding the new session Error forwarding the request Failed to connect to /<Node_IP>:<Node_PORT>
    at org.openqa.grid.web.servlet.handler.RequestHandler.process(RequestHandler.java:118)
    at org.openqa.grid.web.servlet.DriverServlet.process(DriverServlet.java:86)
    at org.openqa.grid.web.servlet.DriverServlet.doPost(DriverServlet.java:70)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
    at org.seleniumhq.jetty9.servlet.ServletHolder.handle(ServletHolder.java:860)
    at org.seleniumhq.jetty9.servlet.ServletHandler.doHandle(ServletHandler.java:535)
    at org.seleniumhq.jetty9.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
    at org.seleniumhq.jetty9.security.SecurityHandler.handle(SecurityHandler.java:548)
    at org.seleniumhq.jetty9.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
    at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:190)
    at org.seleniumhq.jetty9.server.session.SessionHandler.doHandle(SessionHandler.java:1595)
    at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:188)
    at org.seleniumhq.jetty9.server.handler.ContextHandler.doHandle(ContextHandler.java:1253)
    at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextScope(ScopedHandler.java:168)
    at org.seleniumhq.jetty9.servlet.ServletHandler.doScope(ServletHandler.java:473)
    at org.seleniumhq.jetty9.server.session.SessionHandler.doScope(SessionHandler.java:1564)
    at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextScope(ScopedHandler.java:166)
    at org.seleniumhq.jetty9.server.handler.ContextHandler.doScope(ContextHandler.java:1155)
    at org.seleniumhq.jetty9.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
    at org.seleniumhq.jetty9.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
    at org.seleniumhq.jetty9.server.Server.handle(Server.java:530)
    at org.seleniumhq.jetty9.server.HttpChannel.handle(HttpChannel.java:347)
    at org.seleniumhq.jetty9.server.HttpConnection.onFillable(HttpConnection.java:256)
    at org.seleniumhq.jetty9.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:279)
    at org.seleniumhq.jetty9.io.FillInterest.fillable(FillInterest.java:102)
    at org.seleniumhq.jetty9.io.ChannelEndPoint$2.run(ChannelEndPoint.java:124)
    at org.seleniumhq.jetty9.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:247)
    at org.seleniumhq.jetty9.util.thread.strategy.EatWhatYouKill.produce(EatWhatYouKill.java:140)
    at org.seleniumhq.jetty9.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:131)
    at org.seleniumhq.jetty9.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:382)
    at org.seleniumhq.jetty9.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:708)
    at org.seleniumhq.jetty9.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:626)
    at java.lang.Thread.run(Unknown Source)

1 个答案:

答案 0 :(得分:0)

我为自己的查询找到了解决方案,这是一个非常简单的解决方案,我早些时候就知道了,但是对此没有提出任何其他想法。

基本上,我必须从一个特定的端口启动该节点,并从安全组中将该端口号列入白名单。

再次感谢所有努力回答问题的人。希望这对陷入类似情况的人们有所帮助。