间歇性出现 appium 未知服务器端错误
intermittently occuring appium unknown server-side error
我似乎间歇性地遇到这个问题。如果我要拔下并重新插入设备并重新执行测试,没有错误,但这只是临时修复,直到它再次出现。
我有 2 个用于 2 个设备的 appium 服务器实例-
server1
Host-0.0.0.0
server port-5050
Bootstrap port- 4734
allow session overrides- ticked
server2
Host-0.0.0.0
server port-4723
Bootstrap port- 4724
allow session overrides- ticked
appium 版本- 1.15.1
List of devices attached-
52002dd24392b5a1 device
5200472dec01a4a9 device
appium 服务器控制台错误-
W3C] Encountered internal error running command: Error: Cannot start the 'com.XYZ.XYZ' application. Visit https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/android/activity-startup.md for troubleshooting. Original error: Error executing adbExec. Original error: 'Command ''C:\Users\XYZ\AppData\Local\Android\Sdk\platform-tools\adb.exe' -P 5037 -s 5200472dec01a4a9 shell am start -W -n com.XYZ.XYZ/host.exp.exponent.LauncherActivity -S' timed out after 120000ms'. Try to increase the 120000ms adb execution timeout represented by 'adbExecTimeout' capability
[W3C] at ADB.startApp (C:\Program Files\Appium\resources\app\node_modules\appium\node_modules\appium-adb\lib\tools\apk-utils.js:153:11)
[HTTP] <-- POST /wd/hub/session 500 132866 ms - 1782
[HTTP]
[Instrumentation] .
[Instrumentation] Time: 123.085
[Instrumentation]
[Instrumentation] OK (1 test)
[Instrumentation] The process has exited with code 0
IDE-
错误
org.openqa.selenium.SessionNotCreatedException: Unable to create a new remote session. Please check the server log for more details. Original error: An unknown server-side error occurred while processing the command. Original error: Cannot start the 'com.XYZ.XYZ' application. Visit https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/android/activity-startup.md for troubleshooting. Original error: Error executing adbExec. Original error: 'Command ''C:\Users\XYZ\AppData\Local\Android\Sdk\platform-tools\adb.exe' -P 5037 -s 5200472dec01a4a9 shell am start -W -n com.XYZ.XYZ/host.exp.exponent.LauncherActivity -S' timed out after 120000ms'. Try to increase the 120000ms adb execution timeout represented by 'adbExecTimeout' capability
Driver info: driver.version: AndroidDriver
remote stacktrace: UnknownError: An unknown server-side error occurred while processing the command. Original error: Cannot start the 'com.XYZ.XYZ' application. Visit https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/android/activity-startup.md for troubleshooting. Original error: Error executing adbExec. Original error: 'Command ''C:\Users\XYZ\AppData\Local\Android\Sdk\platform-tools\adb.exe' -P 5037 -s 5200472dec01a4a9 shell am start -W -n com.XYZ.XYZ/host.exp.exponent.LauncherActivity -S' timed out after 120000ms'. Try to increase the 120000ms adb execution timeout represented by 'adbExecTimeout' capability
设备 1 所需的功能-
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("deviceName", "Tab");
capabilities.setCapability("platformVersion", "8.0.0");
capabilities.setCapability("platformName", "ANDROID");
capabilities.setCapability("udid", "5200472dec01a4a9");
capabilities.setCapability("noReset", "true");
capabilities.setCapability("appPackage", "com.xyz.xyz");
capabilities.setCapability("appActivity", "host.exp.exponent.LauncherActivity");
capabilities.setCapability("adbExecTimeout", 120000);
capabilities.setCapability("newCommandTimeout", 3000);
capabilities.setCapability("noSign", "true");
URL mobileURL = new URL("http://0.0.0.0:5050/wd/hub");
mobileParent = new AndroidDriver(mobileURL, capabilities);
设备 2 的移动功能-
capabilities.setCapability("deviceName", "Tab");
capabilities.setCapability("platformVersion", "8.0.0");
capabilities.setCapability("platformName", "ANDROID");
capabilities.setCapability("udid", "52002dd24392b5a1");
capabilities.setCapability("noReset", "true");
capabilities.setCapability("appPackage", "com.coachhire.kura");
capabilities.setCapability("appActivity", "host.exp.exponent.LauncherActivity");
capabilities.setCapability(AndroidMobileCapabilityType.AUTO_GRANT_PERMISSIONS, true);
capabilities.setCapability("adbExecTimeout", 120000);
capabilities.setCapability("newCommandTimeout", 3000);
capabilities.setCapability("noSign", "true");
URL mobileURL = new URL("http://0.0.0.0:4723/wd/hub");
mobileDriver = new AndroidDriver(mobileURL, capabilities);
非常感谢任何帮助!
看你提供的细节,应该没有错误。它应该工作正常。
当 Appium 无法找出为 运行 提供的功能列表时,通常会出现未知错误。我建议仔细检查 appPackage 和 appActivity 细节是否正确。
此外,请尝试 运行 在一台设备上进行测试并查看是否有任何错误。查看测试的一致性 运行。如果没有错误,您可以再添加一台设备并查看它的运行情况。
在下面添加功能,
"automationName": "UiAutomator2"
如果您运行正在本地machine 上测试,请使用http://127.0.0.1:<Port>/wd/hub
代替0.0.0.0
如果您正在 运行ning 进行远程测试,请确保在上面将本地 IP 127.0.0.0
替换为 Appium 服务器 运行ning 的 machine IP。
由于您仅 运行 宁 Android 设备,我希望根据 Android 测试设置安装先决条件软件。
对于 mac 设备设置,请按照此处的步骤操作 - https://www.swtestacademy.com/how-to-install-appium-on-mac/
尝试以下步骤,
检查您是否可以通过以下命令 运行ning 手动安装应用程序。
adb -P <port> -s <device id > shell pm install -t -g <apk path>
如果可以,说明设备没有问题。否则,您应该重置设备并重新测试。
检查 Appium 服务器 运行 没有问题。并访问此 link 并看到您在 appium 服务器控制台上获得 200 响应。
http://<appium server ip>:4723/wd/hub/sessions
如果您在那里看到错误,则表明 Appium 存在问题。卸载安装稳定版Appium,重新测试
您应该知道,有时 Node.js 无法与 127.0.0.1:4723
通话,因此请使用 0.0.0.0:4723
代替,反之亦然。请记住在代码 (DesiredCapabilities) 和 appium 设置中更改此项。
尝试 "udid" 所需功能需要参数 -
示例,caps.setCapability("udid", "ce0217124184c72505");
//来自"adb devices"命令的DeviceId
我似乎间歇性地遇到这个问题。如果我要拔下并重新插入设备并重新执行测试,没有错误,但这只是临时修复,直到它再次出现。 我有 2 个用于 2 个设备的 appium 服务器实例-
server1
Host-0.0.0.0
server port-5050
Bootstrap port- 4734
allow session overrides- ticked
server2
Host-0.0.0.0
server port-4723
Bootstrap port- 4724
allow session overrides- ticked
appium 版本- 1.15.1
List of devices attached-
52002dd24392b5a1 device
5200472dec01a4a9 device
appium 服务器控制台错误-
W3C] Encountered internal error running command: Error: Cannot start the 'com.XYZ.XYZ' application. Visit https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/android/activity-startup.md for troubleshooting. Original error: Error executing adbExec. Original error: 'Command ''C:\Users\XYZ\AppData\Local\Android\Sdk\platform-tools\adb.exe' -P 5037 -s 5200472dec01a4a9 shell am start -W -n com.XYZ.XYZ/host.exp.exponent.LauncherActivity -S' timed out after 120000ms'. Try to increase the 120000ms adb execution timeout represented by 'adbExecTimeout' capability
[W3C] at ADB.startApp (C:\Program Files\Appium\resources\app\node_modules\appium\node_modules\appium-adb\lib\tools\apk-utils.js:153:11)
[HTTP] <-- POST /wd/hub/session 500 132866 ms - 1782
[HTTP]
[Instrumentation] .
[Instrumentation] Time: 123.085
[Instrumentation]
[Instrumentation] OK (1 test)
[Instrumentation] The process has exited with code 0
IDE-
错误org.openqa.selenium.SessionNotCreatedException: Unable to create a new remote session. Please check the server log for more details. Original error: An unknown server-side error occurred while processing the command. Original error: Cannot start the 'com.XYZ.XYZ' application. Visit https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/android/activity-startup.md for troubleshooting. Original error: Error executing adbExec. Original error: 'Command ''C:\Users\XYZ\AppData\Local\Android\Sdk\platform-tools\adb.exe' -P 5037 -s 5200472dec01a4a9 shell am start -W -n com.XYZ.XYZ/host.exp.exponent.LauncherActivity -S' timed out after 120000ms'. Try to increase the 120000ms adb execution timeout represented by 'adbExecTimeout' capability
Driver info: driver.version: AndroidDriver
remote stacktrace: UnknownError: An unknown server-side error occurred while processing the command. Original error: Cannot start the 'com.XYZ.XYZ' application. Visit https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/android/activity-startup.md for troubleshooting. Original error: Error executing adbExec. Original error: 'Command ''C:\Users\XYZ\AppData\Local\Android\Sdk\platform-tools\adb.exe' -P 5037 -s 5200472dec01a4a9 shell am start -W -n com.XYZ.XYZ/host.exp.exponent.LauncherActivity -S' timed out after 120000ms'. Try to increase the 120000ms adb execution timeout represented by 'adbExecTimeout' capability
设备 1 所需的功能-
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("deviceName", "Tab");
capabilities.setCapability("platformVersion", "8.0.0");
capabilities.setCapability("platformName", "ANDROID");
capabilities.setCapability("udid", "5200472dec01a4a9");
capabilities.setCapability("noReset", "true");
capabilities.setCapability("appPackage", "com.xyz.xyz");
capabilities.setCapability("appActivity", "host.exp.exponent.LauncherActivity");
capabilities.setCapability("adbExecTimeout", 120000);
capabilities.setCapability("newCommandTimeout", 3000);
capabilities.setCapability("noSign", "true");
URL mobileURL = new URL("http://0.0.0.0:5050/wd/hub");
mobileParent = new AndroidDriver(mobileURL, capabilities);
设备 2 的移动功能-
capabilities.setCapability("deviceName", "Tab");
capabilities.setCapability("platformVersion", "8.0.0");
capabilities.setCapability("platformName", "ANDROID");
capabilities.setCapability("udid", "52002dd24392b5a1");
capabilities.setCapability("noReset", "true");
capabilities.setCapability("appPackage", "com.coachhire.kura");
capabilities.setCapability("appActivity", "host.exp.exponent.LauncherActivity");
capabilities.setCapability(AndroidMobileCapabilityType.AUTO_GRANT_PERMISSIONS, true);
capabilities.setCapability("adbExecTimeout", 120000);
capabilities.setCapability("newCommandTimeout", 3000);
capabilities.setCapability("noSign", "true");
URL mobileURL = new URL("http://0.0.0.0:4723/wd/hub");
mobileDriver = new AndroidDriver(mobileURL, capabilities);
非常感谢任何帮助!
看你提供的细节,应该没有错误。它应该工作正常。
当 Appium 无法找出为 运行 提供的功能列表时,通常会出现未知错误。我建议仔细检查 appPackage 和 appActivity 细节是否正确。
此外,请尝试 运行 在一台设备上进行测试并查看是否有任何错误。查看测试的一致性 运行。如果没有错误,您可以再添加一台设备并查看它的运行情况。
在下面添加功能,
"automationName": "UiAutomator2"
如果您运行正在本地machine 上测试,请使用http://127.0.0.1:<Port>/wd/hub
代替0.0.0.0
如果您正在 运行ning 进行远程测试,请确保在上面将本地 IP 127.0.0.0
替换为 Appium 服务器 运行ning 的 machine IP。
由于您仅 运行 宁 Android 设备,我希望根据 Android 测试设置安装先决条件软件。
对于 mac 设备设置,请按照此处的步骤操作 - https://www.swtestacademy.com/how-to-install-appium-on-mac/
尝试以下步骤,
检查您是否可以通过以下命令 运行ning 手动安装应用程序。
adb -P <port> -s <device id > shell pm install -t -g <apk path>
如果可以,说明设备没有问题。否则,您应该重置设备并重新测试。
检查 Appium 服务器 运行 没有问题。并访问此 link 并看到您在 appium 服务器控制台上获得 200 响应。
http://<appium server ip>:4723/wd/hub/sessions
如果您在那里看到错误,则表明 Appium 存在问题。卸载安装稳定版Appium,重新测试
您应该知道,有时 Node.js 无法与 127.0.0.1:4723
通话,因此请使用 0.0.0.0:4723
代替,反之亦然。请记住在代码 (DesiredCapabilities) 和 appium 设置中更改此项。
尝试 "udid" 所需功能需要参数 -
示例,caps.setCapability("udid", "ce0217124184c72505");
//来自"adb devices"命令的DeviceId