How to configure android device (mobile/tablet) and run selenium script on them

Below are the steps to configure android device
  1. Download and extract android sdk ( note : sdk folder and  adkmanager  should be in the same folder eclipse is extracted in selproject folder)
  2.  Install android ADT plug in for Eclipse.Go to help menu in eclipse --> install new software --> add -->enter the name : ADT  and url: https://dl-ssl.google.com/android/eclipse/ after restart specify the sdk path ( usually---- drive:\seleniumprojectfolder\sdk)
  3. Attach the device (android device,,, mobile / tablet /ipad..etc)
  4. Install the WebDriver APK, type the command   : adb devices in the below folder to get serial id of the device

  •   We need to retrieve the serial id with the following command: /android_sdk/platform-tools/adb devices
  •  Download the Android server from http://code.google.com/p/selenium/downloads/list and save it in the      platform-tools directory. To install the application enter: $./adb -s <serialId> -e install -r android-server.apk
  •  Start the Android WebDriver application,by running this command: $./adb -s <serialId> shell am start -a android.intent.action.MAIN -n org.openqa.selenium.android.app/.MainActivity
  • Now we need to setup the port forwarding in order to forward traffic from the host machine to the emulator. Enter the following in the terminal: $./adb -s <serialId> forward tcp:8080 tcp:8080
  • Write selenium script in eclipse and run. The script should run on the device