Selenium 网格:"Could not find a non-loopback ip4 address for this machine" 和 "An illegal reflective access operation has occurred"
Selenium Grid: "Could not find a non-loopback ip4 address for this machine" and "An illegal reflective access operation has occurred"
我正在尝试设置一个 Selenium 网格,其中集线器位于 Windows10 中,节点位于 Ubuntu 中。我已经在 virtualbox 中安装了 ubuntu(在我的 HOST win10 中安装了 运行)。当我尝试注册一个节点时,出现 "Could not find a non-loopback ip4 address for this machine" 错误。我对这个问题一无所知。请帮忙解决
我在论坛上发现了类似的问题,但没有明确的解决方案。
当我连接到 LAN 时,收到以下消息。
org.openqa.selenium.WebDriverException: Cound not find a non-loopback ip4 address for this machine
如果我切换到 Wifi,会出现如下不同的错误。
-VirtualBox:~/Documents$ java -Dwebdriver.gecko.driver="/home/mehamgn/Documents/drivers/geckodriver/" -jar selenium-server-standalone-3.12.0.jar -role node -nodeConfig grid_node.json
18:54:46.792 INFO [GridLauncherV3.launch] - Selenium build info: version: '3.12.0', revision: '7c6e0b3'
18:54:46.860 INFO [GridLauncherV3.launch] - Launching a Selenium Grid node on port 5555
2018-05-24 18:54:51.656:INFO::main: Logging initialized @14625ms to org.seleniumhq.jetty9.util.log.StdErrLog
18:54:55.286 INFO [SeleniumServer.boot] - Selenium Server is up and running on port 5555
18:54:55.294 INFO [GridLauncherV3.launch] - Selenium Grid node is up and ready to register to the hub
18:54:55.383 INFO [SelfRegisteringRemote.run] - Starting auto registration thread. Will try to register every 10000 ms.
18:54:55.388 INFO [SelfRegisteringRemote.registerToHub] - Registering the node to the hub: http://localhost:4444/grid/register
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.openqa.selenium.json.BeanToJsonConverter (file:/home/mehamgn/Documents/selenium-server-standalone-3.12.0.jar) to method sun.reflect.annotation.AnnotatedTypeFactory$AnnotatedTypeBaseImpl.getDeclaredAnnotations()
WARNING: Please consider reporting this to the maintainers of org.openqa.selenium.json.BeanToJsonConverter
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
18:55:00.088 INFO [SelfRegisteringRemote.run] - Couldn't register this node: Error sending the registration request: Failed to connect to localhost/127.0.0.1:4444
18:55:10.159 INFO [SelfRegisteringRemote.run] - Couldn't register this node: The hub is down or not responding: Failed to connect to localhost/127.0.0.1:4444
18:55:20.171 INFO [SelfRegisteringRemote.run] - Couldn't register this node: The hub is down or not responding: Failed to connect to localhost/127.0.0.1:4444
18:55:30.181 INFO [SelfRegisteringRemote.run] - Couldn't register this node: The hub is down or not responding: Failed to connect to localhost/127.0.0.1:4444
18:55:40.185 INFO [SelfRegisteringRemote.run] - Couldn't register this node: The hub is down or not responding: Failed to connect to localhost/127.0.0.1:4444
18:55:50.198 INFO [SelfRegisteringRemote.run] - Couldn't register this node: The hub is down or not responding: Failed to connect to localhost/127.0.0.1:4444
节点配置JSON文件
{
"capabilities":
[
{
"browserName":"firefox",
"version":"60.0.1",
"maxInstances":1
},
{
"browserName":"chrome",
"version":"66.0.3359.181",
"maxInstances":1
}],
"port":5555,
"hubHost":"192.168.2.8",
"hubPort":4444,
"registerCycle":10000,
"register":true,
"timeout":0,
"maxSessions":2
}
这是第一条错误消息...
org.openqa.selenium.WebDriverException: Cound not find a non-loopback ip4 address for this machine
...表示由于 /etc/hosts (Ubuntu) 文件或 \WINDOWS\system32\drivers\etc\hosts (Windows) 文件.
您可以在
中找到类似的讨论
第二条错误信息...
18:54:55.388 INFO [SelfRegisteringRemote.registerToHub] - Registering the node to the hub: http://localhost:4444/grid/register
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.openqa.selenium.json.BeanToJsonConverter (file:/home/mehamgn/Documents/selenium-server-standalone-3.12.0.jar) to method sun.reflect.annotation.AnnotatedTypeFactory$AnnotatedTypeBaseImpl.getDeclaredAnnotations()
WARNING: Please consider reporting this to the maintainers of org.openqa.selenium.json.BeanToJsonConverter
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
18:55:00.088 INFO [SelfRegisteringRemote.run] - Couldn't register this node: Error sending the registration request: Failed to connect to localhost/127.0.0.1:4444
18:55:10.159 INFO [SelfRegisteringRemote.run] - Couldn't register this node: The hub is down or not responding: Failed to connect to localhost/127.0.0.1:4444
...表示 Selenium Grid Node 未成功注册到 Selenium Grid Hub
但是启动 Selenium 网格节点 的命令看起来容易出错,应该如下所示:
java -Dwebdriver.gecko.driver=/home/mehamgn/Documents/drivers/geckodriver -jar selenium-server-standalone-3.12.0.jar -role node -nodeConfig grid_node.json
注:
-Dwebdriver.gecko.driver
的值必须以二进制名称结尾,例如geckodriver(省略尾随 /
)
- 确保您传递的 nodeConfig.json 文件(根据您使用的代码
grid_node.json
)
我正在尝试设置一个 Selenium 网格,其中集线器位于 Windows10 中,节点位于 Ubuntu 中。我已经在 virtualbox 中安装了 ubuntu(在我的 HOST win10 中安装了 运行)。当我尝试注册一个节点时,出现 "Could not find a non-loopback ip4 address for this machine" 错误。我对这个问题一无所知。请帮忙解决
我在论坛上发现了类似的问题,但没有明确的解决方案。
当我连接到 LAN 时,收到以下消息。
org.openqa.selenium.WebDriverException: Cound not find a non-loopback ip4 address for this machine
如果我切换到 Wifi,会出现如下不同的错误。
-VirtualBox:~/Documents$ java -Dwebdriver.gecko.driver="/home/mehamgn/Documents/drivers/geckodriver/" -jar selenium-server-standalone-3.12.0.jar -role node -nodeConfig grid_node.json
18:54:46.792 INFO [GridLauncherV3.launch] - Selenium build info: version: '3.12.0', revision: '7c6e0b3'
18:54:46.860 INFO [GridLauncherV3.launch] - Launching a Selenium Grid node on port 5555
2018-05-24 18:54:51.656:INFO::main: Logging initialized @14625ms to org.seleniumhq.jetty9.util.log.StdErrLog
18:54:55.286 INFO [SeleniumServer.boot] - Selenium Server is up and running on port 5555
18:54:55.294 INFO [GridLauncherV3.launch] - Selenium Grid node is up and ready to register to the hub
18:54:55.383 INFO [SelfRegisteringRemote.run] - Starting auto registration thread. Will try to register every 10000 ms.
18:54:55.388 INFO [SelfRegisteringRemote.registerToHub] - Registering the node to the hub: http://localhost:4444/grid/register
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.openqa.selenium.json.BeanToJsonConverter (file:/home/mehamgn/Documents/selenium-server-standalone-3.12.0.jar) to method sun.reflect.annotation.AnnotatedTypeFactory$AnnotatedTypeBaseImpl.getDeclaredAnnotations()
WARNING: Please consider reporting this to the maintainers of org.openqa.selenium.json.BeanToJsonConverter
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
18:55:00.088 INFO [SelfRegisteringRemote.run] - Couldn't register this node: Error sending the registration request: Failed to connect to localhost/127.0.0.1:4444
18:55:10.159 INFO [SelfRegisteringRemote.run] - Couldn't register this node: The hub is down or not responding: Failed to connect to localhost/127.0.0.1:4444
18:55:20.171 INFO [SelfRegisteringRemote.run] - Couldn't register this node: The hub is down or not responding: Failed to connect to localhost/127.0.0.1:4444
18:55:30.181 INFO [SelfRegisteringRemote.run] - Couldn't register this node: The hub is down or not responding: Failed to connect to localhost/127.0.0.1:4444
18:55:40.185 INFO [SelfRegisteringRemote.run] - Couldn't register this node: The hub is down or not responding: Failed to connect to localhost/127.0.0.1:4444
18:55:50.198 INFO [SelfRegisteringRemote.run] - Couldn't register this node: The hub is down or not responding: Failed to connect to localhost/127.0.0.1:4444
节点配置JSON文件
{
"capabilities":
[
{
"browserName":"firefox",
"version":"60.0.1",
"maxInstances":1
},
{
"browserName":"chrome",
"version":"66.0.3359.181",
"maxInstances":1
}],
"port":5555,
"hubHost":"192.168.2.8",
"hubPort":4444,
"registerCycle":10000,
"register":true,
"timeout":0,
"maxSessions":2
}
这是第一条错误消息...
org.openqa.selenium.WebDriverException: Cound not find a non-loopback ip4 address for this machine
...表示由于 /etc/hosts (Ubuntu) 文件或 \WINDOWS\system32\drivers\etc\hosts (Windows) 文件.
您可以在
第二条错误信息...
18:54:55.388 INFO [SelfRegisteringRemote.registerToHub] - Registering the node to the hub: http://localhost:4444/grid/register
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.openqa.selenium.json.BeanToJsonConverter (file:/home/mehamgn/Documents/selenium-server-standalone-3.12.0.jar) to method sun.reflect.annotation.AnnotatedTypeFactory$AnnotatedTypeBaseImpl.getDeclaredAnnotations()
WARNING: Please consider reporting this to the maintainers of org.openqa.selenium.json.BeanToJsonConverter
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
18:55:00.088 INFO [SelfRegisteringRemote.run] - Couldn't register this node: Error sending the registration request: Failed to connect to localhost/127.0.0.1:4444
18:55:10.159 INFO [SelfRegisteringRemote.run] - Couldn't register this node: The hub is down or not responding: Failed to connect to localhost/127.0.0.1:4444
...表示 Selenium Grid Node 未成功注册到 Selenium Grid Hub
但是启动 Selenium 网格节点 的命令看起来容易出错,应该如下所示:
java -Dwebdriver.gecko.driver=/home/mehamgn/Documents/drivers/geckodriver -jar selenium-server-standalone-3.12.0.jar -role node -nodeConfig grid_node.json
注:
-Dwebdriver.gecko.driver
的值必须以二进制名称结尾,例如geckodriver(省略尾随/
)- 确保您传递的 nodeConfig.json 文件(根据您使用的代码
grid_node.json
)