Home » appium-tutorial » Mobile Application Command

Newly Updated Posts

Mobile Application Command

In previous topic we have discussed Identify Element Using UIAutomatorViewer, in this topic we will discuss Appium Mobile Application command.

What are Mobile Application Commands in Appium?

Those commands which helps in riding and controls the mobile application in terms of installation, launch, perform multiple activity etc with in application is refereed to as mobile commands.

Lets discuss Appium Mobile Application command in details:

1 ) launchApp(): This commands re-launches the current application once its been closed. The basic syntex of launchApp()


2) closeApp(): This commands closes the current running application from the mobile window and the script stops execution.


3) resetApp(): As we run this commands, all the cache and the cookie gets cleaned for the application and removes the previous backlogs.


How to Run Application on background?

4) runAppInBackground(): This command help to run the application in background mode or in other words the application running in mobile device is not visible on screen.

This commands takes int as a parameter and returns nothing or Void, we pass time in seconds as a parameter.

Note: If we want to run our application permanently on background, we can pass time or parameter as -1;

driver.runAppInBackground(10); //where 10 represents 10 seconds
driver.runAppInBackground(-1); //Runs application permanently on background

5) startActivity(): If we want to open another application in mobile device or execute any automation script which requires to run two different application to open in single run.

The startActivity() commands requires app Package and app activity as a paramater and returns nothing or Void.

For example, if we want to open calculator application, we hit the commands as below.

driver.startActivity("com.miui.calculator","com.miui.calculator.cal.CalculatorActivity"); // Parameter are app package and app activity of calculator

6) currentActivity(): In Mobile application every page or every window of mobile application has its app activity, so if we want to get the app activity of any page or window, we can call this method, this command takes no parameter and returns a String.


7) isAppInstalled(): This command gives the confirmation of installation of an application. This commands requires the bundleId as a parameter and returns boolean.


8) installApp(appPath): We can use this command to direct install an application to the mobile device. This command requires appPath or apk file and returns nothing or Void.

driver.installApp(appPath); // appPath is the APK file of android application

9) removeApp(appPath): This command will remove the application from the mobile device . This command requires bundleId or app Package and returns nothing or Void.

driver.removeApp(appPath); // appPath is the APK file of android application


So in the above tutorial we have discussed the basic commands for mobile application, further we will discuss commands to Touch gesture, and identification of object with different attributes.