Appium 运行报错:selenium.common.exceptions.WebDriverException: Message: An unknown server-side error occurred while processing the command. Original error: Cannot start the ‘com.hlfonts.richway’ 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 ‘D:\android-sdk\platform-tools\adb.exe -P 5037 -s 3462760482002OA shell am start -W -n com.hlfonts.richway/.ui.activity.LoginActivity -S’ exited with code 4294967295’; Stderr: 'Exception occurred while executing ‘start’:
错误分析:
使用adb shell dumpsys window | findstr “usedApp” 查找对应的包名和界面名称的时候未获取到最上层的app界面名称 导致跳转的时候都导致报错:
解决方法:
使用 adb shell dumpsys activity activities | findstr mActivityComponent
获取所有的包名和界面名称
其中mActivityComponent 后面跟的是当前界面的包名和界面名称
注意:
第一命令可以获取大部分应用真实的包名和界面名称,但是部分应用可能存在蒙层,从而可能导致报错。
多个程序在真机后台运行的时候可能获取到多个包名和界面名
结合第一个名称组合使用可以快速定位该界面名