尝试在Ubuntu 14上通过带有xvfb的ssh在无头数字海洋机器上运行selenium节点。安装所有软件包,chrome-browser在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上,节点尝试连接到集线器,而在无头数字海洋上没有任何反应,集线器不会在/ grid / console页面上列出节点。 唯一的线索是节点日志的最后几行不同。
无头数字海洋:
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]
在我的电脑上运行相同的示例:
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
答案 0 :(得分:1)
答案 1 :(得分:0)
如果您在Linux上运行虚拟机或无头服务器(包括Digital Ocean VM)中的selenium节点,您可能会遇到此问题。这是因为您的VM /服务器没有足够的熵可用。
要解决此问题,只需安装haveged
(或其他类似的东西)。
要在CentOS 7上安装,您需要启用EPEL,然后运行:
yum install haveged
systemctl enable haveged
systemctl start haveged
对于其他Linux发行版,请参阅:https://www.digitalocean.com/community/tutorials/how-to-setup-additional-entropy-for-cloud-servers-using-haveged