ANDROID WEBDRIVER

In this article I want to tell you about my first experience with Android WebDriver.

And so begin ….

Here is a step-by-step instruction for using Android WebDriver. Well let’s follow it.

Steps to successful using of Android WebDriver :

1)      Download  Android SDK.

2)      Create emulator using AVD Manager or via console (whatever you like)

3)      Start emulator

Now it’s time to write our first test, but it not so simple as would like. We have two ways to run the tests:

1)      Using the remote server

2)      Using the Android test framework

We can read more about those methods in our instruction.

For myself, I chose first method (Using the remote server), because tests will be run in different browsers, not just on Android. And so begin the implementation:

1)      First download Android Server apk from here

2)      Get the serial ID of device

adb devices

3)      Install the application(Android Server) on device

adb -s <serialId> -e install -r  android-server.apk

4)      Start the Android WebDriver

adb -s <serialId> shell am start -a android.intent.action.MAIN -n org.openqa.selenium.android.app/.MainActivity

5)      Setup the port forwarding in order to forward traffic from the host machine to the emulator.

adb -s <serialId> forward tcp:8080 tcp:8080

It seems to be simply and smoothly. It’s time to our test. I decided not to reinvent the wheel to check the success of the setup and again follows to instructions (see here)

When I clicked button Run, I saw google.com main page on a virtual device, and then nothing, our test hangs. For fun, tried to run through FirefoxDriver, as expected, everything works.

I decided to change version of the Android emulator, after that I again found some nasty surprises:

1)  As we being warned in our instructions, emulator has a bug in the Gingerbread. So there I was not able to try anything, because apk always crashed, when I running tests (despite the fact, that this is the most popular version of Android for the moment)

2)  Honeycomb (3.x), I used at the beginning and I not able run my test with success

3)  To try Froyo (2.2) need to download an older version apk, because it is simply not supported in latest versions. And it again a bit annoying, because need to spent time to configure ant to run tests on all versions. So I decided not to touch Froyo for now

4)  There is Ice Cream Sandwich (4.0.x) in the end. There was a problem too. I was unable to communicate with the virtual device using adb (received error message:” error: protocol fault”).

Result

Of course the ability to automate testing of Web applications through the Android tempting. But my first experience is not let me seriously perceive Android WebDriver. I’ll hope for the best.

PS. If someone has an idea why I did not succeed, accomplish your goal in the comments 🙂

Courtesy: http://www.intexsoft.com/blog/item/144-android-webdriver-one-history.html