Android WebDriver without the SDK

The Android WebDriver docs imply that you need the Android SDK and a USB connection to run Selenium tests on an Android device. This is not the case. You can run the WebDriver APK and connect via Wi-Fi.

On your device:

  1. Enable non-Market apps (Settings > Applications)
  2. Download the latest android-server APK from http://code.google.com/p/selenium/downloads/list
  3. Install the APK
  4. Launch WebDriver
  5. Determine your IP (Settings > Wireless & networks > Wi-Fi settings > SSID)

On your workstation:

  1. Confirm that WebDriver is running and available by browsing to http://device_ip:8080/wd/hub/.
  2. Run your Selenium script as usual (I use the Python bindings):
    from selenium import webdriver
    android = webdriver.Remote(command_executor='http://device_ip:8080/wd/hub',  desired_capabilities=webdriver.DesiredCapabilities.ANDROID)
    android.get("http://www.google.com")
    # File will be saved on your workstation, not the device
    android.get_screenshot_as_file("android_google.png")
    android.quit()
    

    Screenshot of www.google.com from Android WebDriver

Leave a Reply

Your email address will not be published.