Wednesday, January 15, 2014

Steps to Configure Selenium WebDriver in Android Device

Steps to Configure Selenium Web Driver in Android Device


1. Install  Android SDK 
Download the SDK zip file and unzip in your local computer.
Say download at “C:\android ” location
Go to unzipped folder and click on “Android SDK Manager” and install the following:
         a.Tools
         b.Extras
         c.Android API’s as per your choice (Say Android 2.2 , Android 4.0)

2. Install the ADT Plugin for Eclipse-
Goto Help > Install New Software....>> Add
3.Configure ADT Plugin
Window > Preferences...>>Android
Set the SDK location to where is your Android SDK has been installed.
Location will be something like:  C:\android\android-sdk-windows

4. Add the new AVD
In Eclipse goto Window >>AVD Manager>>
Create new AVD by clicking on “New” button.(Give the AVD  name  and select the Target)

5.Now download the Android APK 
Copy the file and paste it in the “Platform-tools” folder of the unzipped Android SDK.
Location will be something like “C:\android\android-sdk-windows\platform-tools 

6. Now start the Android AVD (Which has been created in Step 4) by following below in your Eclipse
Window >>AVD Manager>> Select the created AVD and click on “Start”

7.  Find the installed emulator device id .
open the command prompt ( cmd ) and run the following command 
adb devices
Emulator device id will be something like “emulator-5554

8. Now from the command prompt, go to the “Platform-tools” folder of the unzipped Android SDK
cd "C:\android\android-sdk-windows\platform-tools"

9. Install the Android server by running the following command
adb -s emulator-id -e install -r  android-server-2.21.0.apk

10. Start the Android WebDriver application by running the following command
adb -s emulator-id shell am start -a android.intent.action.MAIN -n org.openqa.selenium.android.app/.MainActivity -e debug true

11. Now setup the port forwarding in order to forward traffic from the host machine to the emulator by running the following command
adb -s emulator-id forward tcp:8080 tcp:8080

No comments:

Post a Comment