尝试在Ubuntu 14上使用xvfb通过ssh在无头Digital Ocean机器上运行selenium节点。安装了所有软件包,chrome浏览器在xvfb上正确启动。
它的行为很奇怪:没有错误,但是根本不尝试连接集线器。而是仅启动Jetty。
确切的命令行:
xvfb-run -a --server-args="-screen 0 1920x1280x24" java -Djava.net.preferIPv4Stack=true -jar selenium-server-standalone-2.48.2.jar -role node -Dwebdriver.chrome.driver=./chromedriver -hub "http://localhost:4444/grid/register" -browser "browserName=chrome, platform=LINUX, maxInstances=5, chrome.binary=/usr/bin/chromium-browser"
在我的本地PC上,该节点尝试连接到集线器,而在无头Digital Ocean上则什么也没有发生,并且集线器未在/ grid / console页面上列出该节点。 唯一的线索是节点日志的最后几行不同。
无头 digital ocean :
11:55:53.483 INFO - Version Jetty/5.1.x
11:55:53.484 INFO - Started HttpContext[/selenium-server,/selenium-server]
我的电脑:
17:52:04.859 INFO - Selenium Grid node is up and ready to register to the hub
17:52:04.877 INFO - Starting auto registration thread. Will try to register every 5000 ms.
17:52:04.877 INFO - Registering the node to the hub: http://46.101.128.117:4444/grid/register
17:52:04.936 INFO - The node is registered to the hub and ready to use
任何想法可能有什么问题吗?有人成功完成了类似的设置吗?
无头 digital ocean 上的完整日志:
11:55:52.753 INFO - Launching a Selenium Grid node
11:55:52.820 INFO - Adding browserName=chrome, platform=LINUX, maxInstances=5, chrome.binary=/usr/bin/chromium-browser
Setting system property webdriver.chrome.driver to ./chromedriver
11:55:53.347 INFO - Java: Oracle Corporation 25.45-b02
11:55:53.348 INFO - OS: Linux 3.19.0-22-generic amd64
11:55:53.354 INFO - v2.48.0, with Core v2.48.0. Built from revision 41bccdd
11:55:53.433 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:55:53.434 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:55:53.434 INFO - Driver class not found: com.opera.core.systems.OperaDriver
11:55:53.435 INFO - Driver provider com.opera.core.systems.OperaDriver is not registered
11:55:53.483 INFO - Version Jetty/5.1.x
11:55:53.484 INFO - Started HttpContext[/selenium-server,/selenium-server]
在我的PC上运行的同一示例给出了:
17:52:04.341 INFO - Launching a Selenium Grid node
17:52:04.387 INFO - Adding browserName=chrome, platform=LINUX, maxInstances=5, chrome.binary=/usr/bin/chromium-browser
Setting system property webdriver.chrome.driver to ./chromedriver
17:52:04.750 INFO - Java: Oracle Corporation 25.45-b02
17:52:04.750 INFO - OS: Linux 3.19.0-30-generic amd64
17:52:04.754 INFO - v2.48.0, with Core v2.48.0. Built from revision 41bccdd
17:52:04.816 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
17:52:04.817 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
17:52:04.818 INFO - Driver class not found: com.opera.core.systems.OperaDriver
17:52:04.818 INFO - Driver provider com.opera.core.systems.OperaDriver is not registered
17:52:04.859 INFO - Selenium Grid node is up and ready to register to the hub
17:52:04.877 INFO - Starting auto registration thread. Will try to register every 5000 ms.
17:52:04.877 INFO - Registering the node to the hub: http://46.101.128.117:4444/grid/register
17:52:04.936 INFO - The node is registered to the hub and ready to use
最佳答案
我有解决方案。
它已经在Selenium stand alone server hang while starting中进行了描述。
根本原因:Digital Ocean机器的熵弱,因此需要使用其他软件工具。
如果硒检测到并显示一些消息而不是挂起,那就太好了。
关于selenium - 通过SSH Xvfb的 Selenium 节点Digital Ocean-不尝试连接到集线器,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/33527933/