My Thoughts: Setup of Android WebDriver in Eclipse

Wednesday, April 25

Setup of Android WebDriver in Eclipse



Here are the Instruction for how to setup Android driver in Eclipse

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

If you have any problem then here is the official Reference :



11 comments:

  1. I am getting the following error

    org.openqa.selenium.remote.UnreachableBrowserException: Error communicating with the remote browser. It may have died.



    Can any one tell what may be the issue

    ReplyDelete
  2. Hi,

    I have configured android driver by following all the steps but while creating instance

    AndroidDriver driver = new AndroidDriver();

    i am getting the below exception during run time could you please help..whether i have missed anything..

    java.lang.NoClassDefFoundError: org.openqa.selenium.android.AndroidDriver
    at com.example.android.notepad.test.Browser1.testGoogle(Browser1.java:14)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:190)
    at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:175)
    at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:555)
    at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1661)

    ReplyDelete
  3. getting can't bind socket error on port forwarding..


    any suggestions?

    ReplyDelete
  4. Thanks Vamsi, your tutorial is simply amazing.

    ReplyDelete
  5. Thanks Vamsi, your tutorial is simply amazing.

    ReplyDelete
  6. How to setup Android Web driver in Linux platform ? please help

    ReplyDelete
  7. Selenium’s own AndroidDriver and iPhoneDriver are retired. Please follow below link this may help you.

    https://github.com/appium/appium/blob/master/docs/running-on-linux.md

    ReplyDelete
  8. Selenium’s own AndroidDriver and iPhoneDriver's are retired. We have to use other alternatives.

    http://seleniumhq.wordpress.com/2013/12/24/android-and-ios-support/

    ReplyDelete
  9. Selenium own AndroidDriver and iPhoneDriver's are retired. We have to use other alternatives.

    http://seleniumhq.wordpress.com/2013/12/24/android-and-ios-support/

    ReplyDelete
  10. Selenium own AndroidDriver and iPhoneDrivers are retired. We have to use other alternatives.

    http://seleniumhq.wordpress.com/2013/12/24/android-and-ios-support/

    ReplyDelete