Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/37.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js 无法将多个appium节点连接到selenium网格_Node.js_Selenium_Command Line_Automation_Appium - Fatal编程技术网

Node.js 无法将多个appium节点连接到selenium网格

Node.js 无法将多个appium节点连接到selenium网格,node.js,selenium,command-line,automation,appium,Node.js,Selenium,Command Line,Automation,Appium,我想在多个设备上并行运行appium脚本,但第二个节点总是无法连接到selenium服务器 这是我的selenium服务器日志,它可以完美地启动和注册 D:\Appium>java -jar selenium-server-standalone-2.52.0.jar -port 4444 -role hub m axInstances=2 maxSession=2 -timeout 30000 15:17:45.215 INFO - Launching Selenium Grid hub

我想在多个设备上并行运行appium脚本,但第二个节点总是无法连接到selenium服务器

这是我的selenium服务器日志,它可以完美地启动和注册

D:\Appium>java -jar selenium-server-standalone-2.52.0.jar -port 4444 -role hub m
axInstances=2 maxSession=2 -timeout 30000
15:17:45.215 INFO - Launching Selenium Grid hub
2016-02-25 15:17:45.810:INFO::main: Logging initialized @732ms
15:17:45.818 INFO - Will listen on 4444
15:17:45.856 INFO - Will listen on 4444
2016-02-25 15:17:45.859:INFO:osjs.Server:main: jetty-9.2.z-SNAPSHOT
2016-02-25 15:17:45.879:INFO:osjsh.ContextHandler:main: Started o.s.j.s.ServletC
ontextHandler@b0ed20{/,null,AVAILABLE}
2016-02-25 15:17:45.893:INFO:osjs.ServerConnector:main: Started ServerConnector@
76c8cd{HTTP/1.1}{0.0.0.0:4444}
2016-02-25 15:17:45.894:INFO:osjs.Server:main: Started @816ms
15:17:45.894 INFO - Nodes should register to http://10.51.25.88:4444/grid/regist
er/
15:17:45.894 INFO - Selenium Grid hub is up and running
15:18:13.259 INFO - Registered a node http://10.51.25.88:4724
15:18:25.289 INFO - Marking the node http://10.51.25.88:4724 as down: cannot rea
ch the node for 2 tries
这是我的Json文件,用于创建节点和设置功能

{"capabilities":[{"deviceName":"0009aec74c7a5f","browserName":"chrome","maxInstances":1,"version":"4.1.2","platform":"ANDROID"}],"configuration":{"proxy":"org.openqa.grid.selenium.proxy.DefaultRemoteProxy","cleanUpCycle":2000,"port":4724,"host":"10.51.25.88","maxSession":1,"hubHost":"10.51.25.88","registerCycle":5000,"hubPort":4444,"timeout":30000,"url":"http:\/\/10.51.25.88:4724\/wd\/hub","register":true}}
因此,当我尝试连接第二个appium节点时,它在没有任何命令提示错误日志的情况下无法在appium网格中注册

我有两个通过USB连接的物理设备和通过adb检测到的设备。我使用的是最新版本的Appium 1.4和最新的selenium独立服务器jar文件2.52

我能够为每个第一个节点向selenium服务器注册我的appium节点,无论是哪个设备,但当我尝试连接第二个appium节点时,它无法连接,关闭命令promt时,不会给出任何错误日志

此命令和配置与以前版本的Appium(大约一年前)使用的命令和配置相同,但对于新的Appium版本,第二个节点未注册


是否有其他方法可以将appium节点注册到selenium网格,或者上面缺少了什么?

我已经构建了为每个appium节点生成.json和.bat文件的库。它经过了很好的测试,工作起来很酷。因此,我认为您缺少连接另一个Appium实例的引导端口号

Json文件:

{
"capabilities":
[
{
"DeviceManufacturer":"LGE",
"DeviceModel":"Nexus 5",
"DeviceOS":"Android",
"OSVersion":"6.0.1",
"DeviceType":"Real",
"deviceName":"038d1797094778a8",
"browserName":"Real_LGE_Nexus 5_Android_6.0.1",
"platform":"Android"
}],
"configuration":
{
"nodeTimeout":120,
"port":4723,
"hubPort":4444,
"proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
"url":"http://192.168.1.246:4723/wd/hub",
"hub": "192.168.1.246:4444/grid/register",
"hubHost":"192.168.1.246",
"nodePolling":2000,
"registerCycle":10000,
"register":true,
"cleanUpCycle":2000,
"timeout":30000,
"maxSession":5
}
}
您一定注意到我正在使用多个功能,但我正在通过重写org.openqa.grid.internal.utils.DefaultCapabilityMatcher类的matches方法来使用所有功能。所以当我调用org.openqa.grid.selenium.GridLauncher类的main方法时。我将我的重写jar保持在相同的类路径中,它用于定制匹配节点

.bat文件:

请注意.bat文件-->--bootstrap 6024中的这一点

node.exe "C:\Program Files (x86)\Appium\node_modules\appium\bin\appium.js" --address 192.168.1.132 --port 4830 --bootstrap 4830 -U 038d1797094778a8 --nodeconfig D:\MobileBaseProjectRepository\Grid\Node\nodeConfig_192.168.1.132_2.json --session-override
所以,回到您的问题上来,在调用appium节点时使用--bootstrap 6024,您将通过