使用 Appium 网格时无法使用超过 2 个设备执行测试
Can’t execute test with more than 2 devices when using Appium grid
上下文:
我用 Appium 编写自动化测试脚本已经有一段时间了,大部分时间一切正常,但现在我正在尝试使用 Appium 网格对多个设备执行测试,并且在执行测试时遇到问题超过 2 台设备。
问题:
使用超过 2 个设备时无法使用 Appium 网格执行测试。
我几乎可以确定问题出在节点配置上,我只是尝试按照在线示例进行操作,但没有找到定义的任何地方,节点配置中的强制性内容。
我的设置是这样的:
节点配置文件:
所有设备都是物理设备
LG K11:
{
"capabilities":
[
{
"deviceName":"xxxxxxx",
"version":"7.1.2",
"platformName":"Android",
"automationName": "Appium”,
"udid":"xxxxxxx"
}
],
"configuration":
{
"cleanUpCycle":3000,
"timeOut":300000,
"proxy":"org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
"url":"http://127.0.0.1:4723/wd/hub",
"host":"127.0.0.1",
"port": 4723,
"register": true,
"registerCycle": 5000,
"hubPort":4444,
"hubHost":"127.0.0.1",
"hubProtocol": "http"
}
}
三星平板电脑 S4:
{
"capabilities":
[
{
"deviceName":"xxxxxxx",
"version":"8.1.0",
"platformName":"Android",
"automationName": "Appium",
"udid":"xxxxxxx"
}
],
"configuration":
{
"cleanUpCycle":3000,
"timeOut":300000,
"proxy":"org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
"url":"http://127.0.0.1:4492/wd/hub",
"host":"127.0.0.1",
"port":4492,
"register": true,
"registerCycle": 5000,
"hubPort":4444,
"hubHost":"127.0.0.1",
"hubProtocol": "http"
}
}
三星 Galaxy S9:
{
"capabilities":
[
{
"deviceName":"xxxxxxx",
"version":"8.0.0",
"platformName":"Android",
"automationName": "Appium",
"udid":"xxxxxxx"
}
],
"configuration":
{
"cleanUpCycle":3000,
"timeOut":300000,
"proxy":"org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
"url":"http://127.0.0.1:8201/wd/hub",
"host":"127.0.0.1",
"port":8201,
"register": true,
"registerCycle": 5000,
"hubPort":4444,
"hubHost":"127.0.0.1",
"hubProtocol": "http"
}
}
我通过在 4 个单独的终端选项卡中执行以下命令来启动节点:
1)java-jar selenium-server-standalone-3.141.59.jar-role hub
2)appium -p 4723 --nodeconfig= /LG_K11.json
3)appium -p 4492 --nodeconfig= /Samsung_Tab_S4.json
4)appium -p 8201 --nodeconfig= /Samsung_Galaxy_S9.json
然后在 IntelliJ 中我 运行 使用此代码来初始化节点:
我只更改了端口、udid 和 deviceName 功能,我 运行 在单独的线程中初始化方法并等待它们全部完成。
initDevice(String udid, int port){
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("platformName", "Android");
capabilities.setCapability("deviceName",udid );
capabilities.setCapability("appPackage", “xxxxxxxxx”);
capabilities.setCapability("appActivity","MainActivity");
capabilities.setCapability("platformName","Android");
capabilities.setCapability("udid",udid);
capabilities.setCapability("noReset", true);
try {
String appiumServerURL = String.format("http://127.0.0.1:%d/wd/hub", port);
driver = new AndroidDriver(new URL(appiumServerURL), desiredCapabilities);
} catch (MalformedURLException e) {
e.printStackTrace();
}
}
并且在初始化之后,当我尝试执行任何命令(例如 findElement)时,我在其中一台设备上发生了崩溃:
org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: Android bootstrap socket crashed: Error: This socket has been ended by the other party
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: ‘xxxxxx’, ip: ‘xxxxxxxxxx’, os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.14.3', java.version: '1.8.0_191'
Driver info: io.appium.java_client.android.AndroidDriver
Capabilities {appActivity: MainActivity, appPackage: xxxxxxxxxx, databaseEnabled: false, desired: {appActivity: MainActivity, appPackage: xxxxxxxx, deviceName: xxxxxx, noReset: true, platformName: android, udid: xxxxxxxx}, deviceManufacturer: samsung, deviceModel: SM-G960F, deviceName: xxxxxxx, deviceScreenSize: 1440x2960, deviceUDID: xxxxxxx, javascriptEnabled: true, locationContextEnabled: false, networkConnectionEnabled: true, noReset: true, platform: LINUX, platformName: Android, platformVersion: 8.0.0, takesScreenshot: true, udid: xxxxxxxxxx, warnings: {}, webStorageEnabled: false}
Session ID: xxxxxxxx
*** Element info: {Using=xpath, value=//android.widget.ImageView[@content-desc="More options"]}
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:187)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:122)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:49)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:158)
at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:239)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552)
at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:42)
at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
at io.appium.java_client.android.AndroidDriver.execute(AndroidDriver.java:1)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:323)
at io.appium.java_client.DefaultGenericMobileDriver.findElement(DefaultGenericMobileDriver.java:62)
at io.appium.java_client.AppiumDriver.findElement(AppiumDriver.java:1)
at io.appium.java_client.android.AndroidDriver.findElement(AndroidDriver.java:1)
at org.openqa.selenium.remote.RemoteWebDriver.findElementByXPath(RemoteWebDriver.java:428)
at io.appium.java_client.DefaultGenericMobileDriver.findElementByXPath(DefaultGenericMobileDriver.java:152)
at io.appium.java_client.AppiumDriver.findElementByXPath(AppiumDriver.java:1)
at io.appium.java_client.android.AndroidDriver.findElementByXPath(AndroidDriver.java:1)
at org.openqa.selenium.By$ByXPath.findElement(By.java:353)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:315)
at io.appium.java_client.DefaultGenericMobileDriver.findElement(DefaultGenericMobileDriver.java:58)
at io.appium.java_client.AppiumDriver.findElement(AppiumDriver.java:1)
at io.appium.java_client.android.AndroidDriver.findElement(AndroidDriver.java:1)
at org.openqa.selenium.support.ui.ExpectedConditions.apply(ExpectedConditions.java:205)
at org.openqa.selenium.support.ui.ExpectedConditions.apply(ExpectedConditions.java:201)
at org.openqa.selenium.support.ui.FluentWait.until(FluentWait.java:249)
at xxxxxxxxx.BaseScreen.waitAndFind(BaseScreen.java:77)
at xxxxxxxxx.screens.BaseScreen.waitAndFind(BaseScreen.java:73)
at xxxxxxxxx.screens.MainScreen.getBroadcastOptionsButton(MainScreen.java:23)
at xxxxxxxxx.tests.PositiveFlows.userClicksBroadcastOptionsMenu(PositiveFlows.java:400)
at xxxxxxxxx.tests.PositiveFlows.tc5(PositiveFlows.java:316)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod.runReflectiveCall(FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access[=14=]0(ParentRunner.java:53)
at org.junit.runners.ParentRunner.evaluate(ParentRunner.java:229)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.junit.runner.JUnitCore.run(JUnitCore.java:160)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: Android bootstrap socket crashed: Error: This socket has been ended by the other party
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: xxxxxxx, ip: xxxxxxxx, os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.14.3', java.version: '1.8.0_191'
Driver info: io.appium.java_client.android.AndroidDriver
Capabilities {appActivity: MainActivity, appPackage: xxxxxxx, databaseEnabled: false, desired: {appActivity: MainActivity, appPackage: xxxxxxx, deviceName: xxxxxxx, noReset: true, platformName: android, udid: xxxxxxx}, deviceManufacturer: samsung, deviceModel: SM-G960F, deviceName: xxxxxxx, deviceScreenSize: 1440x2960, deviceUDID: xxxxxxx, javascriptEnabled: true, locationContextEnabled: false, networkConnectionEnabled: true, noReset: true, platform: LINUX, platformName: Android, platformVersion: 8.0.0, takesScreenshot: true, udid: xxxxxxx, warnings: {}, webStorageEnabled: false}
Session ID: xxxxxxx
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:187)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:122)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:49)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:158)
at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:239)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552)
at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:46)
at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
at io.appium.java_client.android.AndroidDriver.execute(AndroidDriver.java:1)
at org.openqa.selenium.remote.RemoteWebDriver.quit(RemoteWebDriver.java:452)
at xxxxxxx.tests.PositiveFlows.tearDown(PositiveFlows.java:476)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod.runReflectiveCall(FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:33)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.junit.runner.JUnitCore.run(JUnitCore.java:160)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
解决了,问题是我需要传递一个bootstrap端口,因为它们有冲突。所以在命令中添加了“-bp 1020x”。
之前:
appium -p 4723 --nodeconfig= /LG_K11.json
之后:
appium -p 4723 -bp 10200 --nodeconfig= /LG_K11.json
这 link 可能会对以后遇到问题的人有所帮助:https://dpgraham.github.io/appium-docs/setup/parallel_tests/
上下文: 我用 Appium 编写自动化测试脚本已经有一段时间了,大部分时间一切正常,但现在我正在尝试使用 Appium 网格对多个设备执行测试,并且在执行测试时遇到问题超过 2 台设备。
问题: 使用超过 2 个设备时无法使用 Appium 网格执行测试。
我几乎可以确定问题出在节点配置上,我只是尝试按照在线示例进行操作,但没有找到定义的任何地方,节点配置中的强制性内容。
我的设置是这样的: 节点配置文件: 所有设备都是物理设备
LG K11:
{
"capabilities":
[
{
"deviceName":"xxxxxxx",
"version":"7.1.2",
"platformName":"Android",
"automationName": "Appium”,
"udid":"xxxxxxx"
}
],
"configuration":
{
"cleanUpCycle":3000,
"timeOut":300000,
"proxy":"org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
"url":"http://127.0.0.1:4723/wd/hub",
"host":"127.0.0.1",
"port": 4723,
"register": true,
"registerCycle": 5000,
"hubPort":4444,
"hubHost":"127.0.0.1",
"hubProtocol": "http"
}
}
三星平板电脑 S4:
{
"capabilities":
[
{
"deviceName":"xxxxxxx",
"version":"8.1.0",
"platformName":"Android",
"automationName": "Appium",
"udid":"xxxxxxx"
}
],
"configuration":
{
"cleanUpCycle":3000,
"timeOut":300000,
"proxy":"org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
"url":"http://127.0.0.1:4492/wd/hub",
"host":"127.0.0.1",
"port":4492,
"register": true,
"registerCycle": 5000,
"hubPort":4444,
"hubHost":"127.0.0.1",
"hubProtocol": "http"
}
}
三星 Galaxy S9:
{
"capabilities":
[
{
"deviceName":"xxxxxxx",
"version":"8.0.0",
"platformName":"Android",
"automationName": "Appium",
"udid":"xxxxxxx"
}
],
"configuration":
{
"cleanUpCycle":3000,
"timeOut":300000,
"proxy":"org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
"url":"http://127.0.0.1:8201/wd/hub",
"host":"127.0.0.1",
"port":8201,
"register": true,
"registerCycle": 5000,
"hubPort":4444,
"hubHost":"127.0.0.1",
"hubProtocol": "http"
}
}
我通过在 4 个单独的终端选项卡中执行以下命令来启动节点: 1)java-jar selenium-server-standalone-3.141.59.jar-role hub
2)appium -p 4723 --nodeconfig= /LG_K11.json
3)appium -p 4492 --nodeconfig= /Samsung_Tab_S4.json
4)appium -p 8201 --nodeconfig= /Samsung_Galaxy_S9.json
然后在 IntelliJ 中我 运行 使用此代码来初始化节点: 我只更改了端口、udid 和 deviceName 功能,我 运行 在单独的线程中初始化方法并等待它们全部完成。
initDevice(String udid, int port){
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("platformName", "Android");
capabilities.setCapability("deviceName",udid );
capabilities.setCapability("appPackage", “xxxxxxxxx”);
capabilities.setCapability("appActivity","MainActivity");
capabilities.setCapability("platformName","Android");
capabilities.setCapability("udid",udid);
capabilities.setCapability("noReset", true);
try {
String appiumServerURL = String.format("http://127.0.0.1:%d/wd/hub", port);
driver = new AndroidDriver(new URL(appiumServerURL), desiredCapabilities);
} catch (MalformedURLException e) {
e.printStackTrace();
}
}
并且在初始化之后,当我尝试执行任何命令(例如 findElement)时,我在其中一台设备上发生了崩溃:
org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: Android bootstrap socket crashed: Error: This socket has been ended by the other party
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: ‘xxxxxx’, ip: ‘xxxxxxxxxx’, os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.14.3', java.version: '1.8.0_191'
Driver info: io.appium.java_client.android.AndroidDriver
Capabilities {appActivity: MainActivity, appPackage: xxxxxxxxxx, databaseEnabled: false, desired: {appActivity: MainActivity, appPackage: xxxxxxxx, deviceName: xxxxxx, noReset: true, platformName: android, udid: xxxxxxxx}, deviceManufacturer: samsung, deviceModel: SM-G960F, deviceName: xxxxxxx, deviceScreenSize: 1440x2960, deviceUDID: xxxxxxx, javascriptEnabled: true, locationContextEnabled: false, networkConnectionEnabled: true, noReset: true, platform: LINUX, platformName: Android, platformVersion: 8.0.0, takesScreenshot: true, udid: xxxxxxxxxx, warnings: {}, webStorageEnabled: false}
Session ID: xxxxxxxx
*** Element info: {Using=xpath, value=//android.widget.ImageView[@content-desc="More options"]}
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:187)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:122)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:49)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:158)
at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:239)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552)
at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:42)
at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
at io.appium.java_client.android.AndroidDriver.execute(AndroidDriver.java:1)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:323)
at io.appium.java_client.DefaultGenericMobileDriver.findElement(DefaultGenericMobileDriver.java:62)
at io.appium.java_client.AppiumDriver.findElement(AppiumDriver.java:1)
at io.appium.java_client.android.AndroidDriver.findElement(AndroidDriver.java:1)
at org.openqa.selenium.remote.RemoteWebDriver.findElementByXPath(RemoteWebDriver.java:428)
at io.appium.java_client.DefaultGenericMobileDriver.findElementByXPath(DefaultGenericMobileDriver.java:152)
at io.appium.java_client.AppiumDriver.findElementByXPath(AppiumDriver.java:1)
at io.appium.java_client.android.AndroidDriver.findElementByXPath(AndroidDriver.java:1)
at org.openqa.selenium.By$ByXPath.findElement(By.java:353)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:315)
at io.appium.java_client.DefaultGenericMobileDriver.findElement(DefaultGenericMobileDriver.java:58)
at io.appium.java_client.AppiumDriver.findElement(AppiumDriver.java:1)
at io.appium.java_client.android.AndroidDriver.findElement(AndroidDriver.java:1)
at org.openqa.selenium.support.ui.ExpectedConditions.apply(ExpectedConditions.java:205)
at org.openqa.selenium.support.ui.ExpectedConditions.apply(ExpectedConditions.java:201)
at org.openqa.selenium.support.ui.FluentWait.until(FluentWait.java:249)
at xxxxxxxxx.BaseScreen.waitAndFind(BaseScreen.java:77)
at xxxxxxxxx.screens.BaseScreen.waitAndFind(BaseScreen.java:73)
at xxxxxxxxx.screens.MainScreen.getBroadcastOptionsButton(MainScreen.java:23)
at xxxxxxxxx.tests.PositiveFlows.userClicksBroadcastOptionsMenu(PositiveFlows.java:400)
at xxxxxxxxx.tests.PositiveFlows.tc5(PositiveFlows.java:316)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod.runReflectiveCall(FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access[=14=]0(ParentRunner.java:53)
at org.junit.runners.ParentRunner.evaluate(ParentRunner.java:229)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.junit.runner.JUnitCore.run(JUnitCore.java:160)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: Android bootstrap socket crashed: Error: This socket has been ended by the other party
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: xxxxxxx, ip: xxxxxxxx, os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.14.3', java.version: '1.8.0_191'
Driver info: io.appium.java_client.android.AndroidDriver
Capabilities {appActivity: MainActivity, appPackage: xxxxxxx, databaseEnabled: false, desired: {appActivity: MainActivity, appPackage: xxxxxxx, deviceName: xxxxxxx, noReset: true, platformName: android, udid: xxxxxxx}, deviceManufacturer: samsung, deviceModel: SM-G960F, deviceName: xxxxxxx, deviceScreenSize: 1440x2960, deviceUDID: xxxxxxx, javascriptEnabled: true, locationContextEnabled: false, networkConnectionEnabled: true, noReset: true, platform: LINUX, platformName: Android, platformVersion: 8.0.0, takesScreenshot: true, udid: xxxxxxx, warnings: {}, webStorageEnabled: false}
Session ID: xxxxxxx
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:187)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:122)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:49)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:158)
at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:239)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552)
at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:46)
at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
at io.appium.java_client.android.AndroidDriver.execute(AndroidDriver.java:1)
at org.openqa.selenium.remote.RemoteWebDriver.quit(RemoteWebDriver.java:452)
at xxxxxxx.tests.PositiveFlows.tearDown(PositiveFlows.java:476)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod.runReflectiveCall(FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:33)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.junit.runner.JUnitCore.run(JUnitCore.java:160)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
解决了,问题是我需要传递一个bootstrap端口,因为它们有冲突。所以在命令中添加了“-bp 1020x”。 之前:
appium -p 4723 --nodeconfig= /LG_K11.json
之后:
appium -p 4723 -bp 10200 --nodeconfig= /LG_K11.json
这 link 可能会对以后遇到问题的人有所帮助:https://dpgraham.github.io/appium-docs/setup/parallel_tests/