Multiple app activites

Hello Appium community.

After a lot of searches online I finally decide to try my luck on this forum.

I recently got into appium and it feels like the hardest thing for me is to understand how the whole appActivity stuff is really working. The app I’m testing currently has a StartActivity followed up by a LoginActivity just to loggon into the application. So to get around this I just made the “startActivity” my appActivity and the “LoginActivity” my appWaitActivity.
I have all these setCapabilities in a @BeforeClass in my test.

I’ve managed to loggin with my app then I get thrown to a “e-id” app that basically just identifies my user then I get thrown back to the original application. Problem is now I get a nullpointerexception when I try to interact with the orginal app again.

So how do I deal with appActivities? If I for example click “button 1” that takes me to another app activity how do I interact with the new activity?

What I’m using, android, eclipse, java , testNG , POM

As always I appreciate all help given.
Regards

1 Like

Hi,
refer this
http://toolsqa.com/mobile-automation/appium/appium-tutorial/

goto the Appium Tutorial: Things to Know

Hi thanks for your answer.

Been reading some of that stuff but still I can’t say I understand how to deal with multiple appActivities in a test, does he specifically talk about this?

Hi,

You need not to select multiple appActivities, there is only one default activity.
which you have to find- launch the appium - click on android icon- click on application path-choose the app( which is present on you computer)- goto Setting-click on pre launch application-click on play icon(which is on top right)

wait for some time it will launch the app on your mobile, observe the logs there you will find the appActivity, copy that activity and paste in your code.

1 Like

your code will something look like this
File app = new File(“F:\Appium_apk\in.amazon.mShop.android.shopping.apk”);
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(CapabilityType.BROWSER_NAME, “”);
capabilities.setCapability(“deviceName”, “YU5010A”);
capabilities.setCapability(“platformVersion”, “5.1.1”);
capabilities.setCapability(“platformName”, “Android”);
capabilities.setCapability(“app”, app.getAbsolutePath());
capabilities.setCapability(“appPackage”, “in.amazon.mShop.android.shopping”);
capabilities.setCapability(“appActivity”, “com.amazon.mShop.splashscreen.StartupActivity”);

driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);

driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);

continue with your code

1 Like

Thank you. I missunderstood and thought you needed to select all appActivities you were using. The nullpointer exception I got was another issue I had, cheers