Activity used to start app doesn't exist (Cann

2019-07-14 05:57发布

I'm really new to Appium so excuse me if its a repeat question. But, I'm trying to run some tests on the calculator app on Android 5.1.1 using Appium and it results in the following error.

error: Failed to start an Appium session, err was: Error: Activity used to start app doesn't exist or cannot be launched! Make sure it exists and is a launchable activity

info: [debug] Error: Activity used to start app doesn't exist or cannot be launched! Make sure it exists and is a launchable activity

Test Code (capabilities):

capabilities.setCapability("appPackage", "SecCalculator2");
capabilities.setCapability("appActivity", "com.sec.android.app.popupcalculator.Calculator");

I have downloaded the 'APK info' app on my phone and this app shows the following info.

APK path: /system/app/SecCalculator2/SecCalculator2.apk

Activities: com.sec.android.app.popupcalculator.Calculator

So am I using the correct package and activity names in the capabilities?

Thanks in advance

2条回答
叼着烟拽天下
2楼-- · 2019-07-14 06:19

You should add app file name in desired capabilities like below:

capabilities.setCapability("app", "/system/app/SecCalculator2/SecCalculator2.apk"); 

Also you can skip to add "appPackage" and "appActivity" Appium automatically launch application which is mentioned in apk file.

Hope this will help you.

查看更多
SAY GOODBYE
3楼-- · 2019-07-14 06:20

You can correct the appPackage as following :

capabilities.setCapability("appPackage", "com.sec.android.app.popupcalculator");

Assuming mostly the activity names are prefixed with the package name.

Edit : Your logs read incorrect activity name. So probably sometimes the name is provided using a / which would also be mentioned in the appium server logs.

查看更多
登录 后发表回答