Skip to content
Sahi Pro Flowcharts is retired. These pages document the last release (v12) and are no longer updated. Go to the current documentation.Flowcharts is retired. Current docs
Get Free Trial
Sahi Pro Flowcharts is retired. These pages document the last release (v12) and are no longer updated. Go to the current documentation.

Android Automation - Getting Started

This section helps you quickly get started with Android Automation. To automate an Android Devices/Simulators using Sahi Pro Classic, refer Android Automation - Getting Started.

  • Desktop
    • The machine needs to have Android Platform Tools installed so that ADB is available in the system. Having a full blown Android SDK is even better.
    • Make sure the path to the Android Platform Tools folder is added to the PATH environment variable. To test this, open a command prompt and type adb (or adb.exe). ADB should start up if the Android Platform Tools folder is in the PATH.
  • Device
    • Connect the device. Enable USB debugging from Settings -> Developer options.
      • To enable Developer options, go to Setting -> About phone -> scroll to Build number and tap it 7 times.
    • If you already have the driver for the device installed, you should now be connected through adb. If not, install the USB driver for the device.
    • The device has to be connected through USB cable throughout the duration of the test. Alternatively, you can setup adb over Wi-Fi as well if you do not wish to tether the device.
    • Screen lock should be removed and display options should be set such that the device does not sleep throughout the execution of the script.
    • When the device is connected for the first time, you may get an alert asking for permission to connect. Set it to always accept the connection.
    • To know the device ID which is connected to the machine, type adb devices in command prompt.

On the Android device, Google Play Protect scans for apps that are not known to Play Protect and warns the user during installation.

When running a script on the Android device or connecting to it through the Android Viewer for the first time, Sahi first installs 2 apps on the device to facilitate Android testing. Since these apps are for testing purpose and are not from the Play Store, Google Play Protect can display the following warning.

  • Click on Don't send to dismiss the warning.
  • You will see a similar warning for the 2nd app - in.co.sahi.android.test.
  • Click on Don't send again to dismiss the 2nd warning. The connection will proceed successfully.

To prevent the warning message from appearing again, do the following steps.

  1. Open the Play Store app on the device.

  2. At the top right, tap the Profile icon.

  3. Tap Play Protect from the list.

  4. Play Protect screen opens. At the top right, tap the Settings icon.

  5. The following screen opens.

  6. Tap the second option, Improve harmful app detection to switch it OFF. The screen now looks like this.

  7. Connecting the Android Viewer again or running the script will not show the Play Protect warning again.

Download and Install Sahi Pro Mobile Engine

Section titled “Download and Install Sahi Pro Mobile Engine”

You need to install Sahi Pro Mobile Engine before you can proceed with the Quick Tutorial

Connect Session and Element Identification

Section titled “Connect Session and Element Identification”
  1. Connect the Android Device to the system.

  2. Install the Sample Application <SAHI_INSTALLATION_FOLDER>/userdata/android/testapps/AndroidApp.apk on the device.

    • Open a Command Prompt(Windows) or Terminal Shell(Mac, Linux etc.)
    • Type cd <SAHI_INSTALLATION_FOLDER>/userdata/android/testapps and press enter.
    • Type adb install AndroidApp.apk and press enter to install the app.
  3. Start Sahi Dashboard and click on the Flowcharts.

  4. On the Flowcharts window, click on the dropdown arrow next to Launch and then select Launcher Settings.

  5. Launcher Settings dialog opens.

    Description of the image labeling:

    1. Select the Mode: Android
    2. Now select the device from the Device Info dropdown
      Specify Application Package Name:com.sahipro.SahiTestApp
  6. Click on Launch to launch the Application.

  7. This brings up Android Viewer in system’s default browser.

  8. Now click on Connect Session button.

  9. This will start com.sahipro.SahiTestApp application in Android device. The device screen is also visible on the Android Viewer.

  10. On the Flowcharts window, click on the dropdown arrow next to Launch and then select Open Controller. You can now start identifying/automating. Like normal Sahi Pro Flowcharts for web pages, you can use CTRL-Hover to identify various elements on the Java Web Start application.

This is similar to automating a Sahi Pro Flowcharts keyword for normal browser testing.- To automate a Keyword, click on a node from the Sahi Pro Flowcharts page, click on the Automate, click on Start Record button, Actions done on the application in Android device are recorded automatically.

  • Steps can also be recorded from the Flowcharts Controller.

  • A. You can use Click, Set, Assert, choose ‘Other Actions’ to perform an action on the Android device.

    B. You will need to record these steps explicitly by clicking on ‘Add Step’.

  1. On the Automate dialog click on Runbutton.

    Click on Run

  2. The Run Settings dialog opens. Select the Mode Android and click RUN.

  1. Click on the Reports button..

    Click on Report button

  2. The Report opens in a new browser tab.

    Report

Android Automation in Detail
Android Accessor APIs
Mobile APIs
Working with Multiple Modes in a Single Script