gpt4 book ai didi

java - Selenium 网格: "Could not find a non-loopback ip4 address for this machine" and "An illegal reflective access operation has occurred"

转载 作者:行者123 更新时间:2023-11-30 06:09:49 37 4
gpt4 key购买 nike

我正在尝试在 Windows10 中设置一个带有集线器和在 Ubuntu 中设置节点的 Selenium 网格。我已经在 virtualbox 中安装了 ubuntu(在我的主机 win10 中运行)。当我尝试注册节点时,收到错误“无法找到该机器的非环回 ip4 地址”。我对这个问题没有任何线索。请帮忙解决。

我在论坛中发现了类似的问题,但没有明确的解决方案。

当我连接到 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$3.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$3.launch] - Selenium Grid node is up and ready to register to the hub
18:54:55.383 INFO [SelfRegisteringRemote$1.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$1.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$1.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$1.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$1.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$1.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$1.run] - Couldn't register this node: The hub is down or not responding: Failed to connect to localhost/127.0.0.1:4444

nodeConfig 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 中可能发生更改,读取 ip4 地址时出现一些问题\hosts (Windows) 文件。

您可以在Selenium hub fails loading giving an error could not find non loopback ip address中找到类似的讨论

第二个错误消息...

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$1.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$1.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)

关于java - Selenium 网格: "Could not find a non-loopback ip4 address for this machine" and "An illegal reflective access operation has occurred",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50509116/

37 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com