Appium注册网格请求失败:错误:启动Selenium网格节点时getaddrinfo ENOTFOUND http http:80

时间:2018-04-25 18:16:39

标签: java selenium selenium-webdriver appium selenium-grid

我的智慧结束了这一点。我正在尝试通过adb设备可见的连接设备连接Appium(命令行)。使用以下命令启动网格

java -jar ../../selenium-server-standalone-3.6.0.jar -role hub -hubConfig ./hubconfig.json

并按以下方式旋转:

C:\projects\mfa-functional\Selenium Batch Files>java -jar
C:/Selenium/SeleniumGrid/selenium-server-standalone-3.6.0.jar -role hub - 
hubConfig C:/Selenium/SeleniumGrid/BatchFiles/Hub/hubconfig.json
13:40:15.686 INFO - Selenium build info: version: '3.6.0', revision: 
'6fbf3ec767'
13:40:15.687 INFO - Launching Selenium Grid hub
2018-04-25 13:40:16.708:INFO::main: Logging initialized @1540ms to 
org.seleniumhq.jetty9.util.log.StdErrLog
13:40:16.725 INFO - Will listen on 4444
2018-04-25 13:40:16.781:INFO:osjs.Server:main: jetty-9.4.5.v20170502
2018-04-25 13:40:16.816:INFO:osjs.session:main: DefaultSessionIdManager 
workerName=node0
2018-04-25 13:40:16.816:INFO:osjs.session:main: No SessionScavenger set, 
using defaults
2018-04-25 13:40:16.818:INFO:osjs.session:main: Scavenging every 600000ms
2018-04-25 13:40:16.825:INFO:osjsh.ContextHandler:main: Started         
o.s.j.s.ServletContextHandler@2d2e5f00{/,null,AVAILABLE}
2018-04-25 13:40:16.852:INFO:osjs.AbstractConnector:main: Started 
ServerConnector@5b0abc94{HTTP/1.1,[http/1.1]}{0.0.0.0:4444}
2018-04-25 13:40:16.852:INFO:osjs.Server:main: Started @1686ms
13:40:16.853 INFO - Nodes should register to 
http://127.0.0.1:4444/grid/register/
13:40:16.853 INFO - Selenium Grid hub is up and running

使用以下config.json

{
"host": "127.0.0.1",
"maxSessions": 35,
"port": 4444,
"cleanupCycle": 5000,
"timeout": 300000,
"newSessionWaitTimeout": -1,
"servlets": [],
"prioritizer": null,
"capabilityMatcher": "org.openqa.grid.internal.utils.DefaultCapabilityMatcher",
"throwOnCapabilityNotPresent": true,
"nodePolling": 180000,
"platform": "WINDOWS"
}

我正在尝试使用以下命令启动节点以连接到此集线器

appium -a 127.0.0.1 --nodeconfig MKs_tablet.json

MKs_tablet.json如下所示

{
"capabilities":
  [
    {
      "appiumVersion" : "1.8.0",
      "browserName": "andriod",
      "version":"4.4.2",
      "maxInstances": 1,
      "platform":"Android",
      "deviceName" : "KJOVSCGISWSC8HOV"
    }
  ],
  "configuration" : 
  {
      "proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
      "maxSession": 2,
      "url":"http://http://127.0.0.1:4723/wd/hub",
      "host" : "http://127.0.0.1",
      "port": 4723,
      "register": true,
      "registerCycle": 5000,
      "hubPort": 4444,
      "hubHost": "http://127.0.0.1",
      "nodeStatusCheckTimeout": 5000
  }
}

appium节点旋转得很好,但似乎无法连接到网格集线器。结果如下:

C:\Selenium\SeleniumGrid\ExternalDeviceConfig\Appium Device Configs>appium - 
a 127.0.0.1 --nodeconfig MKs_tablet.json
[Appium] Welcome to Appium v1.8.0
[Appium] Non-default server args:
[Appium]   address: 127.0.0.1
[Appium]   nodeconfig: MKs_tablet.json
[debug] [Appium] Starting auto register thread for grid. Will try to 
register every 5000 ms.
[Appium] Appium REST http interface listener started on 127.0.0.1:4723
[Appium] Request to register with grid was unsuccessful: Error: getaddrinfo 
ENOTFOUND http http:80
[debug] [Appium] Hub down or not responding: Error: getaddrinfo ENOTFOUND 
http http:80
[Appium] Request to register with grid was unsuccessful: Error: getaddrinfo 
ENOTFOUND http http:80
[debug] [Appium] Hub down or not responding: Error: getaddrinfo ENOTFOUND 
http http:80
[Appium] Request to register with grid was unsuccessful: Error: getaddrinfo 
ENOTFOUND http http:80
[debug] [Appium] Hub down or not responding: Error: getaddrinfo ENOTFOUND 
http http:80
[Appium] Request to register with grid was unsuccessful: Error: getaddrinfo 
ENOTFOUND http http:80
[debug] [Appium] Hub down or not responding: Error: getaddrinfo ENOTFOUND 
http http:80

我只是忽略了某些事情,因为那里似乎没有任何建议。我发现配置文件有问题。它看起来应该可行

HELP !!!

1 个答案:

答案 0 :(得分:1)

此错误消息......

[Appium] Appium REST http interface listener started on 127.0.0.1:4723
[Appium] Request to register with grid was unsuccessful: Error: getaddrinfo ENOTFOUND http http:80
[debug] [Appium] Hub down or not responding: Error: getaddrinfo ENOTFOUND http http:80

...意味着 Appium客户端无法注册 Selenium Grid Hub

您的主要问题是在 MKs_tablet.json 中参数网址 - nodeconfig ,其中协议 http 被指定两次。

解决方案

- nodeconfig 中, MKs_tablet.json 中的参数 url 必须设置为:

"url":"http://127.0.0.1:4723/wd/hub"