linux - 在 Linux 上设置 Selenium 节点

标签 linux selenium selenium-grid selenium-server

我目前正在尝试在 Linux VM( headless )上设置一个 Selenium 节点。集线器正在从端口 5786 上的 Windows 设备运行(4444 正在使用中)。

我使用以下代码启动集线器:

java -jar selenium-server-standalone-
2.53.0.jar -role node –hub http://<myIP>:5786/grid/register -port 5558

当我执行此操作时,它会返回以下错误消息:

13:42:12.765 INFO - Launching a Selenium Grid node
13:42:13.435 WARN - error getting the parameters from the hub. The node may 
end up with wrong timeouts.Connect to 10.146.48.80:4444 [/10.146.48.80] 
failed: Connection refused
13:42:13.445 INFO - Java: Oracle Corporation 24.60-b09
13:42:13.445 INFO - OS: Linux 3.10.0-514.21.1.el7.x86_64 amd64
13:42:13.450 INFO - v2.53.0, with Core v2.53.0. Built from revision 35ae25b
13:42:13.521 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 LINUX
13:42:13.521 INFO - Driver provider org.openqa.selenium.edge.EdgeDriver 
registration is skipped:
registration capabilities Capabilities [{platform=WINDOWS, 
browserName=MicrosoftEdge, version=}] does not match the current platform 
LINUX
13:42:13.521 INFO - Driver class not found: 
com.opera.core.systems.OperaDriver
13:42:13.521 INFO - Driver provider com.opera.core.systems.OperaDriver is not 
registered
13:42:13.522 INFO - Driver provider org.openqa.selenium.safari.SafariDriver 
registration is skipped:
registration capabilities Capabilities [{platform=MAC, browserName=safari, 
version=}] does not match the current platform LINUX
13:42:13.523 INFO - Driver class not found: 
org.openqa.selenium.htmlunit.HtmlUnitDriver
13:42:13.523 INFO - Driver provider 
org.openqa.selenium.htmlunit.HtmlUnitDriver is not registered
13:42:13.552 INFO - Version Jetty/5.1.x
13:42:13.553 INFO - Started HttpContext[/selenium-server/driver,/selenium-
server/driver]
 13:42:13.553 INFO - Started HttpContext[/selenium-server,/selenium-server]
13:42:13.553 INFO - Started HttpContext[/,/]
13:44:03.596 INFO - Started 
org.openqa.jetty.jetty.servlet.ServletHandler@188fd321
13:44:03.596 INFO - Started HttpContext[/wd,/wd]
13:44:03.599 INFO - Started SocketListener on 0.0.0.0:5555
13:44:03.599 INFO - Started org.openqa.jetty.jetty.Server@a01330f
13:44:03.599 INFO - Selenium Grid node is up and ready to register to the hub
13:44:03.630 INFO - Starting auto registration thread. Will try to register 
every 5000 ms.
13:44:03.630 INFO - Registering the node to the hub: 
http://10.146.48.80:4444/grid/register
13:44:03.638 INFO - Couldn't register this node: Error sending the 
registration request: Connect to 10.146.48.80:4444 [/10.146.48.80] failed: 
Connection refused

最佳答案

在您共享的命令中,即

java -jar selenium-server-standalone-2.53.0.jar -role node –hub http://<myIP>:5786/grid/register -port 5558

您遇到了复制粘贴问题。参数hub 之前的- 好像不是hyphen 字符。

我能够推断出这是一个可能的根本原因,因为 -hub 的值被完全忽略并且正在尝试使用 4444 的默认集线器端口.您共享的堆栈跟踪重复了这一点

13:42:13.435 WARN - error getting the parameters from the hub. The node may end up with wrong timeouts.Connect to 10.146.48.80:4444 [/10.146.48.80] failed: Connection refused

如您所见,即使您提供的 Hub 注册 URL 包含端口号 5786,它仍然会接收到 4444 并提示 Connection refused

请尝试输入启动集线器的完整命令,然后重试。这应该有效。

关于linux - 在 Linux 上设置 Selenium 节点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44977487/

相关文章:

linux - BASH 脚本 : take a filename (with spaces) as argument and use name (no ext) and also full filename as args for scripted command

linux - 查看启动时运行的文件 (linux)

java - 发送 GET 请求后,HttpURLConnection 返回响应代码 500,即使它在本地工作

selenium - 使用脚本设置 Selenium 网格

java - 多个浏览器同时与 Google Guice + TestNG + Selenium GRID + Maven 并行运行测试

selenium - 在 docker 容器内使用 selenium hub 有什么限制吗?

arrays - 使用 bash/awk 将字符串拆分为数组

linux - ssh-keygen 接受标准输入

selenium - 您可以在 Selenium 网格节点上使用 Edge 的多个实例吗?

java - 在以下 HTML 的 Selenium webdriver 中出现 "Element is not currently visible and so may not be interacted with"错误