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这两个软件

  • 8
    点赞
  • 26
    收藏
    觉得还不错? 一键收藏
  • 7
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 7
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值