The new "Start Activity" feature in Appium 1.2.3

Appium 1.2.3 has a new Android-only feature, “Start Activity.” It allows you to start an arbitrary activity at test time. If the activity is part of an application different from the application currently under test, “Start Activity” will also start the activity’s application. Nice!

The “Start Activity” feature requires two arguments, appPackage and appActivity. You can optionally provide “wait” activities via appWaitPackage and appWaitActivity, the same way you can when launching the application under test. Here’s how easy it is to start the activity “.Foo”:

Start Activity

Open an activity in the current app or start a new app and open an activity Android only

// java
driver.startActivity("appPackage","", null, null);
// javascript
driver.startActivity({appPackage: '', appActivity: '.Foo'}, cb);
# python
driver.start_activity('', '.Foo')
# ruby
start_activity app_package: '', app_activity: '.accessibility.AccessibilityNodeProviderActivity'
// c#
driver.StartActivity("", ".Foo");
// php
$this->startActivity(array("appPackage" => "",
                           "appActivity" => ".Foo"));
1 Like

Note that 1.2.3 is a forthcoming release as of 9/16/14.

1 Like

It seems nice. so can we open sms inbox and read specific sms (programatically and part of automation script) while during test.

Priyank Shah

Yes, that should work. E.g., one of the tests I wrote for this feature opens Contacts while testing another application.

What’s the code assigned to driver?

This does not seem to work for Python 3, as there has been some changes to how dictionaries are handled. Trying to start the network selection dialog with driver.start_activity(“”, “.wifi.WifiSetupActivity”) results in an error being thrown.

After you check the SMS (or choose a network in my case), how do you switch back to the original app?

Hey @Priyank_Shah
i am wondering that could you read a specific sms like you mention above.

Watch “Appium Tutorial- Switching between apps (Contact …” on YouTube
Appium Tutorial- Switching between apps (Contact …:

@Appium_Master Is there a way we can set a flag so on start_activity the first app is resumed from where it left instead of starting the fresh ? I am looking to find a solution in Python.