Friday 27 June 2014

Selendroid to Test Mobile Web Applications on Android Mobile Device

Selendroid is a test automation framework which drives off the Android native, hybrid and the mobile web applications. All the tests are written using the Selenium 2 client API.

In previous blog we saw that how to use Android Webdriver to automate the mobile web apps, since Android Webdriver has been deprecated and recommended to use Selendroid.

In this article we will see how to setup Selendroid and will also see example of mobile web application automation. Since Selendroid does not provide the facility to create the virtual devices, hence we will use the same instructions we followed in previous article (Mobile Automation With Android WebDriver).

Pre-Requisites:
Download Android SDK
Unzip it and place it somewhere in directory
Go to /android_sdk/eclipse folder
Launch Eclipse and Select a workspace location
Now navigate Windows >> Preferences >> Run/Debug >> String Substitution
Click New button to add a variable


Now open System Properties and add a variable ANDROID_SDK_HOME


Add a user variable ANDROID_HOME


Check if JAVA_HOME variable is not set then add it as well


Steps to Setup Emulator

      1. To list all the available targets run:




2. First create the Android Virtual Device (AVD)

3. Now start the emulator

And it will start the emulator:


Now download the selendroid-standalone (Selendroid-standalone) jar file.

Creation of automation script

1. Start the eclipse from /android_sdk/eclipse location.

2. Create a project and add selendroid-standalone.jar along with Selenium 2 client API.

see the code snippet for the example:


Now run the code as java application.

Output:


In next article we will see how to identify elements of mobile version web applications.

Please like the page if you like it.