我有两台机器:
1. Linux Centos 6.4
2. Mac OS X 10.8
Linux启动集线器:
[root@jenkins tools]# java -jar selenium-server-standalone-2.46.0.jar -role hub -port 4444
11:35:00.898 INFO - Launching Selenium Grid hub
2015-06-15 11:35:01.744:INFO:osjs.Server:jetty-7.x.y-SNAPSHOT
2015-06-15 11:35:01.969:INFO:osjsh.ContextHandler:started o.s.j.s.ServletContextHandler{/,null}
2015-06-15 11:35:02.028:INFO:osjs.AbstractConnector:Started SocketConnector@0.0.0.0:4444
11:35:02.029 INFO - Nodes should register to http://192.168.1.110:4444/grid/register/
11:35:02.031 INFO - Selenium Grid hub is up and running
然后我启动节点(Mac):
tomas@tororrosso ~/Q/A/tools> java -jar selenium-server-standalone-2.46.0.jar -role node -hub http://192.168.1.110:4444/grid/register/ -host "http://192.168.1.254" -port 4445 --debug
11:36:00.190 INFO - Launching a Selenium Grid node
11:36:00.635 INFO - Java: Apple Inc. 20.51-b01-457
11:36:00.635 INFO - OS: Mac OS X 10.8.5 x86_64
11:36:00.639 INFO - v2.46.0, with Core v2.46.0. Built from revision 87c69e2
11:36:00.675 INFO - Driver provider org.openqa.selenium.ie.InternetExplorerDriver registration is skipped:
registration capabilities Capabilities [{platform=WINDOWS, ensureCleanSession=true, browserName=internet explorer, version=}] does not match the current platform MAC
11:36:00.676 INFO - Driver class not found: com.opera.core.systems.OperaDriver
11:36:00.676 INFO - Driver provider com.opera.core.systems.OperaDriver is not registered
11:36:00.678 INFO - Driver class is built for higher Java version: org.openqa.selenium.htmlunit.HtmlUnitDriver
11:36:00.678 INFO - Driver provider org.openqa.selenium.htmlunit.HtmlUnitDriver is not registered
11:36:00.693 INFO - Version Jetty/5.1.x
11:36:00.694 INFO - Started HttpContext[/selenium-server/driver,/selenium-server/driver]
11:36:00.694 INFO - Started HttpContext[/selenium-server,/selenium-server]
11:36:00.694 INFO - Started HttpContext[/,/]
11:36:00.700 INFO - Started org.openqa.jetty.jetty.servlet.ServletHandler@65493102
11:36:00.700 INFO - Started HttpContext[/wd,/wd]
11:36:00.702 INFO - Started SocketListener on 0.0.0.0:4445
11:36:00.702 INFO - Started org.openqa.jetty.jetty.Server@2092dcdb
11:36:00.703 INFO - Selenium Grid node is up and ready to register to the hub
11:36:00.726 INFO - Starting auto registration thread. Will try to register every 5000 ms.
11:36:00.727 INFO - Registering the node to the hub: http://192.168.1.110:4444/grid/register
11:36:00.735 INFO - The node is registered to the hub and ready to use
一切看起来都非常完美和精彩......
在集线器中:
11:36:50.904 WARN - Cleaning up stale test sessions on the unregistered node http://http://192.168.1.254:4445
节点:
11:36:05.774 INFO - Registering the node to the hub: http://192.168.1.110:4444/grid/register
11:36:05.785 INFO - The node is registered to the hub and ready to use
他们就像这样无限和超越。
两台机器都能看到对方:
tomas@tororrosso ~> ping 192.168.1.110
PING 192.168.1.110 (192.168.1.110): 56 data bytes
64 bytes from 192.168.1.110: icmp_seq=0 ttl=64 time=0.585 ms
64 bytes from 192.168.1.110: icmp_seq=1 ttl=64 time=0.586 ms
64 bytes from 192.168.1.110: icmp_seq=2 ttl=64 time=0.606 ms
^C
--- 192.168.1.110 ping statistics ---
3 packets transmitted, 3 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 0.585/0.592/0.606/0.010 ms
[root@jenkins ]# ping 192.168.1.254
PING 192.168.1.254 (192.168.1.254) 56(84) bytes of data.
64 bytes from 192.168.1.254: icmp_seq=1 ttl=64 time=0.521 ms
64 bytes from 192.168.1.254: icmp_seq=2 ttl=64 time=0.541 ms
^C
--- 192.168.1.254 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1933ms
rtt min/avg/max/mdev = 0.521/0.531/0.541/0.010 ms
我也试过了:
java -jar selenium-server-standalone-2.46.0.jar -role node -hubHost 192.168.1.110 -hubPort 4444 -host "http://192.168.1.254" -port 4446 --debug
但每5秒钟它会不断重新注册。
答案 0 :(得分:1)
我刚刚使用此配置执行了该节点并且工作正常:
<component name="term_" class="Term">
<meta attribute="generated-class" inherit="false">TermData</meta>
<meta attribute="extends">Entity</meta>
<meta attribute="scope-set" inherit="false">protected</meta>
<property name="duration_" column="DURATION" type="int" />
<property name="durationUnits_" column="DURATION_UNITS" type="string" length="64" />
</component>
将其另存为{
"capabilities":
[
{
"browserName": "firefox",
"version": "38.0.5",
"platform": "MAC",
"maxInstances": 1
},
{
"browserName": "chrome",
"version": "43",
"platform": "MAC",
"maxInstances": 1
}
],
"configuration":
{
"nodeTimeout":120,
"host":"192.168.1.254",
"port":4446,
"hubPort":4444,
"hubHost":"192.168.1.110",
"nodePolling":2000,
"registerCycle":10000,
"register":true,
"cleanUpCycle":2000,
"timeout":30000,
"maxSession":1
}
}
然后执行节点:
mac.json
一切正常。