Selenium ChromeDriver for Android

Selenium is well known with automation testing of web applications, but a lot of businesses are moving their attention away from the desktop and onto the mobile platform.

The Selenium ChromeDriver allows Selenium tests to be run in a Chrome browser. The best part, is that the Chrome browser on Android devices are compatible.

The following is a quick start guide to allow Selenium tests to be executed on an Android device with Chrome.


1. On the Android device, navigate to the Developer Options and turn on Android debugging mode.

2. Connect the device to the computer.

3. Open a Command Prompt and run the following adb command to list the connected devices.

> adb devices

4. Take note of the device serial represented by a series of characters and digits, e.g. ZX9G355SPR.

If the device is not listed, ensure the Android USB drivers are installed correctly, restart both the device and computer and try again.

Also make sure when installing the the Android USB drivers that MTP is enabled.

5. Create a new Java project that has the Selenium libraries included.

6. Add the following to setup the ChromeDriver to open the session on the connected device.

public WebDriver getMobileChromeDriver() {  
    System.setProperty("", "/path/to/chromedriver.exe");

    ChromeOptions chromeOptions = new ChromeOptions();
            "androidPackage", "");

    return new ChromeDriver(chromeOptions);

Ensure that the path to the chromedriver.exe is set and the device serial is set for the androidDeviceSerial option.

7. Create a test and set the Selenium WebDriver to the defined ChromeDriver instance.

public void test() {  
    WebDriver driver = getMobileChromeDriver();


8. Run the test and a Chrome browser session will open on the device and navigate to Google.

Now tests written using Selenium can be run seamlessly on the desktop and the mobile device without any additional modifications.

comments powered by Disqus