基于-selenium-grid-连接多个appium-server

2017-01-01 10:46

想并行运行多个appium,效果图:

Paste_Image.png

  • 下载selenium-server-standalone-xxx.jar
  • 执行命令
java -jar selenium-server-standalone-3.0.1.jar  -port 4444 -role hub

Paste_Image.png

  • 配置json1 端口4723文件
{
  "capabilities": [
    {
      "deviceName": "DU2TAN15AJ049163",
      "version": "4.4.2",
      "maxInstances": 3,
      "platform": "ANDROID",
      "browserName": "chrome"
    }
  ],
  "configuration": {
      "cleanUpCycle": 2000,
      "timeout": 300000,
      "browserTimeout": 60000,
      "hub":"127.0.0.1:4444/grid/register",
      "host":"192.168.1.218",
      "maxSession": 6,
      "port": 4723,
      "hubPort": 4444,
      "hubHost": "192.168.1.218",
      "proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
      "url": "http://127.0.0.1:4723/wd/hub",
      "register": true,
      "registerCycle": 5000
    }
}
  • 执行命名,启动端口4723连接hub
node D:\\app\Appium\\node_modules\\appium\\bin\\appium.js  -p 4723 -bp 4733  -U DU2TAN15AJ049163 --nodeconfig D:\app\appium_study\testRunner\test.json

Paste_Image.png

  • 配置json2 文件 4724
{
  "capabilities": [
    {
      "deviceName": "MSM8926", #设备id
      "version": "4.3",
      "maxInstances": 3,
      "platform": "ANDROID",
      "browserName": "chrome"
    }
  ],
  "configuration": {
      "cleanUpCycle": 2000,
      "timeout": 300000,
      "browserTimeout": 60000,
      "hub":"127.0.0.1:4444/grid/register", #链接hub
      "host":"192.168.1.218",
      "maxSession": 6,
      "port": 4724,#端口号
      "hubPort": 4444,
      "hubHost": "192.168.1.218",
      "proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
      "url": "http://127.0.0.1:4724/wd/hub",# 4724 appium服务器
      "register": true,
      "registerCycle": 5000
    }
}
  • 执行命名
node D:\\app\Appium\\node_modules\\appium\\bin\\appium.js  -p 4724 -bp 4734  -U DU2TAN15AJ049163 --nodeconfig D:\app\appium_study\testRunner\test2.json
  • 看看hub 截图

Paste_Image.png

这样就启动了多个appium,在浏览器输入:http://192.168.1.218:4444/grid/console 就能看到你连接了多少个设备

Paste_Image.png