1. 程式人生 > >Appium爬坑

Appium爬坑

信息 win extra tor 解釋 ppa star error 問題

appium Activity used to start app doesn‘t exist or cannot be launched 問題解決

運行appium測試報錯 “error: Failed to start an Appium session, err was: Error: Activity used to start app doesn’t exist or cannot ve launched! Make usre it exists and is launchable activity”

仔細檢查了好幾遍發現,activity是存在的,activity路徑也是正確的

經過一番查找(當時就不淡定了,想到了開始卻沒想到這結尾,流下了沒有技術的眼淚),問題解決如下:

註釋掉setup中的如下兩行:

desired_caps[‘appPackage‘] = ‘com.youdao.calculator.activities‘   
desired_caps[‘appActivity‘] = ‘com.youdao.calculator.activities.MainActivity‘

再次運行,問題解決了。

說明:說明運行測試的時候我們不需要指定package和activity 這些信息,Appium會從apk中提取這些信息。

見:https://github.com/appium/appium/issues/2981 中paymand 的解釋:

Don‘t know about the apk info tool above, but you can always get that info using the aapt tool from Android SDK with the following command:
adt/sdk/build-tools/android-4.4/aapt dump badging app.apk
Note: You shouldn‘t need to specify appPackage, appActivity, etc. since Appium should be able to extract those from the apk using the method above anyway.

Appium爬坑