我正在尝试在我的Mac上启动Selenium Grid集线器,然后在我的Mac上在Windows 7 VM上设置节点(在VirtualBox中运行,如果这很重要)。我在Mac上运行此命令:
java -jar selenium-server-standalone-3.0.1.jar -role hub
然后我得到
Nodes should register to http://10.10.3.1:4444/grid/register/
Selenium Grid hub is up and running
太棒了,真棒。然后我进入我的Windows VM并运行以下命令:
java -jar selenium-server-standalone-3.0.1.jar -role webdriver -hub http://10.10.3.1:4444/grid/register -port 7777 -debug
它最终会超时,无法连接。我粘贴了下面的调试信息。
12:12:11.806 INFO - Selenium build info: version: '3.0.1', revision: '1969d75'
12:12:11.806 INFO - Launching a Selenium Grid node
12:12:12.817 DEBUG - CookieSpec selected: default
12:12:12.827 DEBUG - Auth cache not set in the context
12:12:12.827 DEBUG - Connection request: [route: {}->http://10.10.3.1:4444][tota
l kept alive: 0; route allocated: 0 of 2000; total allocated: 0 of 2000]
12:12:12.857 DEBUG - Connection leased: [id: 0][route: {}->http://10.10.3.1:4444
][total kept alive: 0; route allocated: 1 of 2000; total allocated: 1 of 2000]
12:12:12.887 DEBUG - Opening connection {}->http://10.10.3.1:4444
12:12:12.887 DEBUG - Connecting to /10.10.3.1:4444
12:12:32.753 DEBUG - http-outgoing-0: Shutdown connection
12:12:32.753 DEBUG - Connection discarded
12:12:32.753 DEBUG - Connection released: [id: 0][route: {}->http://10.10.3.1:44
44][total kept alive: 0; route allocated: 0 of 2000; total allocated: 0 of 2000]
12:12:32.753 WARN - error getting the parameters from the hub. The node may end
up with wrong timeouts.Connect to 10.10.3.1:4444 [/10.10.3.1] failed: Connection
timed out: connect
2017-02-02 12:12:32.793:INFO::main: Logging initialized @22740ms
12:12:32.881 INFO - Driver class not found: com.opera.core.systems.OperaDriver
12:12:32.881 INFO - Driver provider com.opera.core.systems.OperaDriver registrat
ion is skipped:
Unable to create new instances on this machine.
12:12:32.881 INFO - Driver class not found: com.opera.core.systems.OperaDriver
12:12:32.881 INFO - Driver provider com.opera.core.systems.OperaDriver is not re
gistered
12:12:32.891 INFO - Driver provider org.openqa.selenium.safari.SafariDriver regi
stration is skipped:
registration capabilities Capabilities [{browserName=safari, version=, platform
=MAC}] does not match the current platform VISTA
2017-02-02 12:12:32.999:INFO:osjs.Server:main: jetty-9.2.15.v20160210
2017-02-02 12:12:33.058:INFO:osjsh.ContextHandler:main: Started o.s.j.s.ServletC
ontextHandler@92efc3{/,null,AVAILABLE}
2017-02-02 12:12:33.077:INFO:osjs.ServerConnector:main: Started ServerConnector@
ee2816{HTTP/1.1}{0.0.0.0:7777}
2017-02-02 12:12:33.077:INFO:osjs.Server:main: Started @23031ms
12:12:33.077 INFO - Selenium Grid node is up and ready to register to the hub
12:12:33.097 DEBUG - Using the json request : {"class":"org.openqa.grid.common.R
egistrationRequest","configuration":{"hubHost":"10.10.3.1","hubPort":4444,"id":"
http://10.0.2.15:7777","capabilities":[{"browserName":"firefox","seleniumProtoco
l":"WebDriver","maxInstances":5,"platform":"VISTA"},{"browserName":"chrome","sel
eniumProtocol":"WebDriver","maxInstances":5,"platform":"VISTA"},{"browserName":"
internet explorer","seleniumProtocol":"WebDriver","maxInstances":1,"platform":"W
INDOWS"}],"hub":"http://10.10.3.1:4444/grid/register","nodeStatusCheckTimeout":5
000,"proxy":"org.openqa.grid.selenium.proxy.DefaultRemoteProxy","register":true,
"registerCycle":5000,"custom":{},"host":"10.0.2.15","maxSession":1,"debug":false
,"port":7777,"role":"node","timeout":1800}}
12:12:33.185 INFO - Starting auto registration thread. Will try to register ever
y 5000 ms.
12:12:33.185 INFO - Registering the node to the hub: http://10.10.3.1:4444/grid/
register
12:12:33.215 DEBUG - CookieSpec selected: default
12:12:33.224 DEBUG - Auth cache not set in the context
12:12:33.224 DEBUG - Connection request: [route: {}->http://10.10.3.1:4444][tota
l kept alive: 0; route allocated: 0 of 2000; total allocated: 0 of 2000]
12:12:33.224 DEBUG - Connection leased: [id: 1][route: {}->http://10.10.3.1:4444
][total kept alive: 0; route allocated: 1 of 2000; total allocated: 1 of 2000]
12:12:33.224 DEBUG - Opening connection {}->http://10.10.3.1:4444
12:12:33.224 DEBUG - Connecting to /10.10.3.1:4444
12:12:54.760 DEBUG - http-outgoing-1: Shutdown connection
12:12:54.760 DEBUG - Connection discarded
12:12:54.760 DEBUG - Connection released: [id: 1][route: {}->http://10.10.3.1:44
44][total kept alive: 0; route allocated: 0 of 2000; total allocated: 0 of 2000]
12:12:54.760 INFO - Couldn't register this node: Error sending the registration
request: Connect to 10.10.3.1:4444 [/10.10.3.1] failed: Connection timed out: co
nnect
*编辑:我试图在Windows VM上运行集线器和节点,并且没有任何问题。我还试图只在Mac上运行集线器和节点,我遇到了同样的问题。这告诉我,这个问题与我的Mac有关。不知道该怎么做....
答案 0 :(得分:0)
事实证明,服务器在尝试自动为集线器分配IP地址时,选择了错误的服务器。出于某种原因,它选择了vpn网关的IP地址。添加 while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC))
{
echo "status = " . $array['status'] . ' = ' . $array['cnt'] .'<br />';
}
解决了我的问题。
答案 1 :(得分:0)
我不认为设置硒网格像1-2-3这样简单
因为我花了几个小时浏览并运行不同的命令。我希望我先进入此页面,也许可以节省我的时间。
感谢kroe761。这是相同的解决方案,但是用对我有用的简单步骤编写它们。 常见错误:我没有注意Step2,它清楚地指出了要在其中注册该节点的URL,我一直在使用Windows10 ip-address,由于该节点未连接到集线器
从此处下载了硒服务器jar文件的最新稳定版本:https://selenium.dev/downloads/ 并将jar文件放在我计划使用的两台机器中,一台用于集线器,另一台用于节点 就我而言,我将Windows10用于集线器,将Windows7 VM用于节点
在Windows10中执行以下命令-命令提示符 java -jar selenium-server-standalone-3.xxx.xx.jar -role hub
15:00:44.044信息[Hub.start]-Selenium Grid Hub已启动并正在运行
15:00:44.045信息[Hub.start]-节点应注册到http://10.0.0.xxx:4444/grid/register/
15:15:51.097信息[SelfRegisteringRemote.registerToHub]-将节点注册到集线器:http://10 .0.0.xxx:4444 / grid / register
15:15:56.394信息[SelfRegisteringRemote.registerToHub]-节点已注册到集线器并读取 y使用