[ Web Proxy ]
URL:
Viewing: https://developer.chrome.com/docs/chromedriver/get-started/android [Back]  [Original]

Android  |  ChromeDriver  |  Chrome for Developers Skip to main content
Chrome for Developers [Chrome for Developers]

Android Stay organized with collections Save and categorize content based on your preferences.

The latest binaries for ChromeDriver are packaged as zip files for various host platforms.

Earlier versions of ChromeDriver can be found in Downloads.

Supported apps

ChromeDriver supports running tests on Chrome browser (version 30+) and WebView-based apps starting in Android 4.4 (KitKat) that have enabled web debugging and JavaScript.

You can install Chrome app from:

Stable: https://play.google.com/store/apps/details?id=com.android.chrome

Beta: https://play.google.com/store/apps/details?id=com.chrome.beta

Selenium WebDriver Language Bindings

The standard Selenium project WebDriver language bindings need to be installed for your language of choice to write your tests. This library is available in your local package manager or the Selenium project.

For example, the language bindings for Python can be installed with pip.

$ pip install selenium

Android SDK

The SDK can be downloaded from developer.android.com/sdk/.

Device requirements

As of Chrome version 33, a rooted device is not required. If running tests on earlier versions of Chrome, devices must be rooted as ChromeDriver required write access to the /data/local directory to set Chrome's command line arguments.

Run ChromeDriver

  1. Start the Android SDK's Android Debug Bridge (adb) server:

    $ adb start-server
    
  2. If testing on Chrome app prior to version 33, ensure adb shell has read and write access to /data/local directory on the device:

    $ adb shell su -c chmod 777 /data/local
    
  3. We recommend that you start ChromeDriver through the Selenium library, though you can also manually start it from the command line.

    $ ./chromedriver
    

Android-only options

The following Chrome Options are applicable to both Chrome and WebView apps:

The following capabilities are only applicable to WebView apps.

Run a test

Tests should pass the app's package name to the ChromeDriver through the androidPackage option. For example, a minimal Python test looks like this:

from selenium import webdriver
options = webdriver.ChromeOptions()
options.add_experimental_option('androidPackage', 'com.android.chrome')
driver = webdriver.Chrome('./chromedriver', options=options)
driver.get('https://google.com')
driver.quit()

Multiple devices

To use a particular device for a session, specify androidDeviceSerial as a Chrome option.

If the serial number isn't specified, the server selects an unused device at random to associate with each session. An error is returned if all devices already have active sessions, so tests should make sure to call quit when finished.

Connect to wd/hub

If your tests expect to connect to wd/hub, you can add --url-base=wd/hub when launching the server:

$ ./chromedriver --url-base=wd/hub

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2024-12-17 UTC.

[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-12-17 UTC."],[],[]]

Web Proxy Viewer  |  New URL  |  Original Page