Appium-Activity used to start app doesn't exist or cannot be launched! Make sure it exists and is a launchable activity

前端 未结 4 596
走了就别回头了
走了就别回头了 2021-01-27 02:20

I am trying to run a test file created on eclipse using appium. When I execute the test on a real android device connected to the system, I get the following error:

Enco

4条回答
  •  既然无缘
    2021-01-27 02:27

    The issue speaks for itself: you either did not provide activity to recognise your app or you specified the wrong one.

    What you can do:

    1. Connect device to laptop, make sure adb debugging is on
    2. Install your app manually and launch it
    3. In terminal run:

    adb shell dumpsys window windows | grep -E 'mCurrentFocus|mFocusedApp'

    1. Check the output, you will get something like:

    com.yourcompany.package/com.yourcompany.package.login.view.LoginActivity

    So now you have package - com.yourcompany.package and activity com.yourcompany.package.login.view.LoginActivity that you should provide Appium.

    1. Add new capabilities, full set should look like: DesiredCapabilities capabilities = new DesiredCapabilities(); capabilities.setCapability("deviceName", "device"); capabilities.setCapability("app", pathToApk); capabilities.setCapability("platformName", "android"); capabilities.setCapability("appWaitPackage", "com.yourcompany.package"); capabilities.setCapability("appWaitActivity", "com.yourcompany.package.login.view.LoginActivity");

    Works perfectly for me on multiple real devices

提交回复
热议问题