Start activity (FR)
Perfecto Command
mobile:activity:open
Purpose
Starts an Android activity on the device. Android applications are composed of a series of "Activity" units. Each Activity presents a UI screen that allows users to perform some part of the application, such as call a number, take a photo, send an email, or view a map. When testing the application, it may be desirable to start the application execution from a specific Activity, rather than the initial Activity (usually referred to as the .Main
).
Applications can be large and complex, written by many development teams. The start activity and sync activity commands enable a tester to start and sync a specific activity on the device and decreases the time it takes to write a test, allowing more coverage in a dynamic environment where time to develop tests is short.
Parameters
Name | Type | Possible Values | Description |
---|---|---|---|
package (Mandatory) |
String |
The Android application identifier. Example: |
|
activity (Mandatory) |
String |
The activity name. Example: |
|
action |
String |
The |
|
category |
String |
The |
|
flags |
String |
The |
|
arguments |
String |
The |
To retrieve the currentActivity
and currentPackage
values to use with this function, use the mobile:device:info function while running the activity.
The intent
is the normal Android mechanism to pass information between application activities.
Return Value
String: OK | Failed
Exceptions
None
Examples
Java sample
Map<String, Object> params = new HashMap<>();
params.put("package", "com.google.android.keep");
params.put("activity", ".BrowseActivity");
String result = (String) driver.executeScript("mobile:activity:open", params);
C# sample
Dictionary<String, Object> pars = new Dictionary<String, Object>();
pars.Add("package", "com.google.android.keep");
pars.Add("activity", ".BrowseActivity");
String result = (String) driver.ExecuteScript("mobile:activity:open", pars);