我安装了selenium-server-standalone-3.4.0.jar并在我的机器A上运行以下命令(如hube):
java -jar selenium-server-standalone-3.4.0.jar -role hub
它成功运行。
然后,在我的机器B(作为节点)上运行以下命令:
java -jar selenium-server-standalone-3.4.0.jar -role node -hub http://192.168.1.27:4444/grid/register
生成以下日志。你可以看到,首先它注册然后它表明它没有注册。怎么可能?
> 11:35:29.561 INFO - Selenium build info: version: '3.4.0', revision: 'unknown'
> 11:35:29.562 INFO - Launching a Selenium Grid node
> 11:35:30.353 WARN - error getting the parameters from the hub. The node may end up with wrong timeouts.com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 12 path $
> 2017-07-23 11:35:30.417:INFO::main: Logging initialized @1343ms to org.seleniumhq.jetty9.util.log.StdErrLog
> 11:35:30.568 INFO - Driver provider org.openqa.selenium.ie.InternetExplorerDriver registration is skipped:
registration capabilities Capabilities [{ensureCleanSession=true, browserName=internet explorer, version=, platform=WINDOWS}] does not match the current platform LINUX
> 11:35:30.568 INFO - Driver provider org.openqa.selenium.edge.EdgeDriver registration is skipped:
registration capabilities Capabilities [{browserName=MicrosoftEdge, version=, platform=WINDOWS}] does not match the current platform LINUX
> 11:35:30.572 INFO - Driver class not found: com.opera.core.systems.OperaDriver
> 11:35:30.572 INFO - Driver provider com.opera.core.systems.OperaDriver registration is skipped:
Unable to create new instances on this machine.
> 11:35:30.573 INFO - Driver class not found: com.opera.core.systems.OperaDriver
> 11:35:30.575 INFO - Driver provider com.opera.core.systems.OperaDriver is not registered
> 11:35:30.585 INFO - Driver provider org.openqa.selenium.safari.SafariDriver registration is skipped:
registration capabilities Capabilities [{browserName=safari, version=, platform=MAC}] does not match the current platform LINUX
> 2017-07-23 11:35:30.729:INFO:osjs.Server:main: jetty-9.4.3.v20170317
> 2017-07-23 11:35:30.828:INFO:osjsh.ContextHandler:main: Started o.s.j.s.ServletContextHandler@70be0a2b{/,null,AVAILABLE}
> 2017-07-23 11:35:30.899:INFO:osjs.AbstractConnector:main: Started ServerConnector@29176cc1{HTTP/1.1,[http/1.1]}{0.0.0.0:5555}
> 2017-07-23 11:35:30.900:INFO:osjs.Server:main: Started @1827ms
> 11:35:30.900 INFO - Selenium Grid node is up and ready to register to the hub
> 11:35:31.017 INFO - Starting auto registration thread. Will try to register every 5000 ms.
> 11:35:31.017 INFO - Registering the node to the hub: http://192.168.1.27:4444/grid/register
> 11:35:31.062 INFO - The node is registered to the hub and ready to use
> 11:35:36.095 INFO - Couldn't register this node: The hub is down or not responding: com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 12 path $
> 11:35:41.123 INFO - Couldn't register this node: The hub is down or not responding: com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 12 path $
> 11:35:46.135 INFO - Couldn't register this node: The hub is down or not responding: com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 12 path $
答案 0 :(得分:1)
以下是您的问题的答案:
假设您的要求是在默认端口{{1}上运行 Selenium Grid Hub
,在默认端口{{1>上运行 4444
我们需要按如下方式配置和启动它们:
启动Selenium Grid Hub:
Selenium Grid Node
以下日志确认您的Selenium Grid Hub正常运行:
5555
通过以下网址访问Selenium Grid Console:
java -jar selenium-server-standalone-3.4.0.jar -role hub
启动Selenium网格节点:
2017-07-24 15:31:46.139:INFO:osjs.Server:main: Started @2757ms
15:31:46.140 INFO - Nodes should register to http://192.168.0.107:4444/grid/register/
15:31:46.140 INFO - Selenium Grid hub is up and running
我使用了http://localhost:4444/grid/console
所以我使用了:
java -jar selenium-server-standalone-3.4.0.jar -role node -hub http://<IP_GRID_HUB>:4444/grid/register
以下日志确认您的Selenium网格节点正常运行:
localhost
通过控制台URL访问Selenium Grid Console以查看已注册的节点:
java -jar selenium-server-standalone-3.4.0.jar -role node -hub http://localhost:4444/grid/register
如果这回答你的问题,请告诉我。
答案 1 :(得分:0)
我能够通过将chrome的版本更新为最新版本(60)以及将chromedriver版本更新为最新版本来解决此问题。
当我在轮毂侧更新了chromedriver的版本时,它终于开始工作了。
当我有一段时间我将切换到seleniumGridExtra,它应该自动管理版本。
我的工作日志: 8/3/2017,10:11:03 AM 仍尝试在集线器/节点设置上运行selenium。它在17个小时前停止了。
更新所涉及的所有文件。
Latest chrome firefox and IE drivers.
Latest selenium version
Update chrome
rebooted machine
Updated chromeDriver on the hub..which seems silly.
Suddenly working fine.
Lessons learned:
Switch to selenium grid extras. They handle the version dependencies.
答案 2 :(得分:0)
我是新手,但这对我有用。我从同一台机器运行集线器和节点,我从窗口批处理文件运行集线器和节点。我首先运行集线器,确保打开窗口,然后运行网格。自从我开始这样做以来,我没有出现连接问题