This site is in read only mode. Please continue to browse, but replying, likes, and other actions are disabled for now.
1 / 7
Aug 2017

Hi,
I am using latest appium 1.6.5 and java - client : 5.0.0-BETA8
I was previously using driver.startActivity using app package and app activity (where were string arguments) and it was working as expected.

Now with above version - looks like all startActivity has been deprecated except driver.startActivity(appActivity) - where appActivity is of type Activity.

I have activity of type string and it throws class cast exception when I try to cast string to Activity.
How do i pass the appactivity of type activity ?

  • created

    Aug '17
  • last reply

    Dec '18
  • 6

    replies

  • 2.5k

    views

  • 5

    users

  • 2

    likes

@PavithraNavaneeth

        Activity activity = new Activity("app package goes here", "app activity goes here");
        activity.setAppWaitPackage("app wait package goes here");
        activity.setAppWaitActivity("app wait activity goes here");
        activity.setStopApp(false);
        ((AndroidDriver) driver).startActivity(activity);
5 months later

Can you please explain with example? suppose I am switching app to messaging app. What would be my code ?

3 months later
6 months later

Hello @Aleksei
I am trying to understand this code
Activity activity = new Activity(“app package goes here”, “app activity goes here”);
So the above we pass the new activity package name?

If we have passed the new app packagename activity name then why we need the below
activity.setAppWaitPackage(“app wait package goes here”);
activity.setAppWaitActivity(“app wait activity goes here”);

What does the below do?
activity.setStopApp(false);

How does the app return back to my old package?

Thanks
VS

@vsharma it is only calls needed APP in needed activity. nothing more.

About stopApp ->

    /**
     * Sets the stop app value.
     *
     * @param stopApp The stop app value.
     * @return self reference
     */
    public Activity setStopApp(boolean stopApp) {
        this.stopApp = stopApp;
        return this;
    }

to return just close app you opened or:

((AndroidDriver) driver).runAppInBackground(1);

should restore back your original app under test.

Thank You @Aleksei I shall try this
Do you have your own Blog :slight_smile: or videos you created for Beginners…