我正在尝试设置Appium Grid以便并行执行。
出现此问题的Appium版本(或git版本):1.13.1 用于运行Appium的桌面操作系统/版本:Windows 10 Node.js版本(除非使用Appium.app | exe):Node.js Npm或Yarn软件包管理器:通过bat文件运行appium 测试中的移动平台/版本:Android 7.0和7.1.1 真实设备或仿真器/模拟器:两者 Appium CLI或Appium.app | exe: appium -p 4725 --udid ZW3226GGPK -bp 5556 --chromedriver-port 5645 --nodeconfig“ D:\ Workspace \ fsp-app-automation \ all.json” -g“ D:\ Workspace \ fsp-app-automation \ appium_1.log”-会话覆盖
所需功能
:System.out.println(portNo+"---"+System.currentTimeMillis());
System.out.println(device_id + "---" + System.currentTimeMillis());
capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, secondDeviceName);
capabilities.setCapability("udid", secondDeviceName);
capabilities.setCapability("platformVersion", "7.1.1");
capabilities.setCapability(MobileCapabilityType.APP, app.getAbsolutePath());
// capabilities.setCapability(MobileCapabilityType.APP, app.getAbsolutePath());
if (AppUtil.prop.containsKey("wait.activity")) {
capabilities.setCapability("appWaitActivity", AppUtil.WAIT_ACTIVITY);
} else {
capabilities.setCapability("appActivity", AppUtil.APP_ACTIVITY);
}
capabilities.setCapability("package", AppUtil.BASE_PKG);
all.json
{
"capabilities":
[
{
"browserName": "Chrome",
"deviceName": "Appium",
"version":"7.0",
"maxInstances": 1,
"platformName":"ANDROID"
},
{
"browserName": "Chrome",
"deviceName": "Appium",
"version":"7.1.1",
"maxInstances": 1,
"platformName":"ANDROID"
}
],
"configuration":
{
"cleanUpCycle": 5000,
"registerCycle": 5000,
"nodeTimeout": 120,
"timeout": 600000,
"nodePolling": 2000,
"hub": "http://localhost:4444/grid/register",
"proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
"maxSession": 10,
"port": 5555,
"host": "localhost",
"register": true,
"hubPort": 4444,
"hubHost" :"localhost",
"role": "node"
}
}
服务器日志
D:\Workspace\fsp-app-automation>java -jar selenium-server-standalone-3.13.0.jar -role hub
11:53:11.800 INFO [GridLauncherV3.launch] - Selenium build info: version: '3.13.0', revision: '2f0d292'
11:53:11.803 INFO [GridLauncherV3$2.launch] - Launching Selenium Grid hub on port 4444
2019-07-08 11:53:12.240:INFO::main: Logging initialized @975ms to org.seleniumhq.jetty9.util.log.StdErrLog
11:53:12.906 INFO [Hub.start] - Selenium Grid hub is up and running
11:53:12.907 INFO [Hub.start] - Nodes should register to http://10.190.50.136:4444/grid/register/
11:53:12.908 INFO [Hub.start] - Clients should connect to http://10.190.50.136:4444/wd/hub
11:53:28.134 INFO [DefaultGridRegistry.add] - Registered a node http://0.0.0.0:4726
11:53:32.296 INFO [DefaultGridRegistry.add] - Registered a node http://0.0.0.0:4725
2019-07-08 11:53:48.888:WARN:osjs.HttpChannel:qtp143110009-16: /wd/hub/session java.io.IOException: org.openqa.grid.common.exception.GridException: Cannot extract a capabilities from the request: {
"desiredCapabilities": {
"app": "D:\Workspace\fsp-app-automation\src\test\resources\com.globalagricentral.apk",
"package": "com.globalagricentral",
"platformVersion": "7.0",
"appWaitActivity": "*.LanguageActivity, .SplashActivity",
"platformName": "Android",
"udid": "ZW3226GGPK",
"deviceName": "ZW3226GGPK"
},
"capabilities": {
"firstMatch": [
{
"appium:app": "D:\Workspace\fsp-app-automation\src\test\resources\com.globalagricentral.apk",
"appium:appWaitActivity": ".LanguageActivity, .SplashActivity",
"appium:deviceName": "ZW3226GGPK",
"package": "com.globalagricentral",
"platformName": "android",
"appium:platformVersion": "7.0",
"appium:udid": "ZW3226GGPK"
}
]
}
}
2019-07-08 11:53:48.888:WARN:osjs.HttpChannel:qtp143110009-15: /wd/hub/session java.io.IOException: org.openqa.grid.common.exception.GridException: Cannot extract a capabilities from the request: {
"desiredCapabilities": {
"app": "D:\Workspace\fsp-app-automation\src\test\resources\com.globalagricentral.apk",
"package": "com.globalagricentral",
"platformVersion": "7.1.1",
"appWaitActivity": ".LanguageActivity, .SplashActivity",
"platformName": "Android",
"udid": "emulator-5554",
"deviceName": "emulator-5554"
},
"capabilities": {
"firstMatch": [
{
"appium:app": "D:\Workspace\fsp-app-automation\src\test\resources\com.globalagricentral.apk",
"appium:appWaitActivity": ".LanguageActivity, *.SplashActivity",
"appium:deviceName": "emulator-5554",
"package": "com.globalagricentral",
"platformName": "android",
"appium:platformVersion": "7.1.1",
"appium:udid": "emulator-5554"
}
]
}
}