本文主要是介绍appium做app自动化无法启动的问题(Original error: Unable to find an active device or emulator with OS 8)等问题,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
一、appium做app自动化遇到的问题汇总
1、Android版本填写错误
‘platformVersion’:’11’
我手机上的版本明明是11,但是填了之后,居然不对,报错:
selenium.common.exceptions.WebDriverException: Message: An unknown server-side error occurred while processing the command. Original error: Unable to find an active device or emulator with OS 8. The following are available: FEC0220515006984 (10)
嘿嘿,有提示,刚开始以为是FEC0220515006984,不对,填括号内的10就对了!还有就是,原来不是看版本号,而是要看“Android版本”
2、appPackage或者appActivity包填写错误
报错信息:
‘appPackage’:‘tv.danmaku.bili’
填错的话,会报错:
selenium.common.exceptions.WebDriverException: Message: An unknown server-side error occurred while processing the command. Original error: Cannot start the ‘tv.danmaku.ili’ application. Visit https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/android/activity-startup.md for troubleshooting. Original error: Activity name ‘.MainActivityV2’ used to start the app doesn’t exist or cannot be launched! Make sure it exists and is a launchable activity
‘appActivity’: ‘.MainActivityV2’
填错的话,会报错:
selenium.common.exceptions.WebDriverException: Message: An unknown server-side error occurred while processing the command. Original error: Cannot start the ‘tv.danmaku.bili’ application. Visit https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/android/activity-startup.md for troubleshooting. Original error: Activity name ‘.AMainActivityV2’ used to start the app doesn’t exist or cannot be launched! Make sure it exists and is a launchable activity
怎么获取真实的appPackage或者appActivity:
1、通过.apk安装包获取
aapt dump badging D:\app_dir\xxxxxx.apk
2、获取模拟器正在运行的APP的Package和Activity
adb shell dumpsys activity | find “mFocusedActivity”
3、(最喜欢用这个)获取真机正在运行的APP的Package和Activity,在手机上把所有应用关闭,只打开自己想看的app:
adb shell dumpsys activity | find “mResumedActivity”
别忘了小数点!!!
4、获取当前页面的Package和Activity
adb shell dumpsys window | findstr mCurrentFocus
5、列出模拟器或真机中所有软件的Package
adb shell pm list packages
6、获取带端口号的Activity
adb shell dumpsys activity top | findstr ACTIVITY
二、第一次运行:
第一次运行会比较慢,因为会在手机上面自动安装Appium Server 和android.apk这两个软件
这篇关于appium做app自动化无法启动的问题(Original error: Unable to find an active device or emulator with OS 8)等问题的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!