This file contains high-level info about how ChromeDriver works and how to contribute. If you are looking for information on how to use ChromeDriver, please see the ChromeDriver user site.
ChromeDriver is an implementation of the WebDriver standard, which allows users to automate testing of their website across browsers.
ChromeDriver source code is located in the Chromium source repository, and shares the same build tools as Chromium. To build ChromeDriver, please first follow the instructions to download and build Chromium.
Once you have set up the build environment, build ChromeDriver by building the
chromedriver target, e.g.,
autoninja -C out/Default chromedriver
This will create an executable binary in the build folder named
Once built, ChromeDriver can be used with various third-party libraries that support WebDriver protocol, including language bindings provided by Selenium.
Note that if your build target OS is Android (i.e., you have
target_os = "android" in your
args.gn file), you will need to use the following command to build ChromeDriver targeting the host system:
autoninja -C out/Default clang_x64/chromedriver
For testing purposes, ChromeDriver can be used interactively with python. The following is an example on Linux. It assumes that you downloaded Chromium repository at ~/chromium/src, and you used out/Default as the build location. You may need to adjust the paths if you used different locations. The following code uses our own testing API, not the commonly used Python binding provided by Selenium.
$ cd ~/chromium/src/chrome/test/chromedriver $ export PYTHONPATH=$PWD:$PWD/server:$PWD/client $ python >>> import server >>> import chromedriver >>> cd_server = server.Server('../../../out/Default/chromedriver') >>> driver = chromedriver.ChromeDriver(cd_server.GetUrl(), cd_server.GetPid()) >>> driver.Load('http://www.google.com') >>> driver.Quit() >>> cd_server.Kill()
By default, ChromeDriver will look in its own directory for Chrome to use. If Chrome is not found there, it will use the system installed Chrome.
To use ChromeDriver with Chrome on Android pass the Android package name in the chromeOptions.androidPackage capability when creating the driver. You also need to have Android SDK's Android Debug Bridge (adb) server running. For more detailed instructions see the user site.
ChromeDriver is shipped separately from Chrome. It controls Chrome out of process through DevTools. ChromeDriver is a standalone server which communicates with the WebDriver client via the WebDriver wire protocol, which is essentially synchronous JSON commands over HTTP. WebDriver clients are available in many languages, and many are available from the open source Selenium WebDriver project. ChromeDriver uses the webserver from net/server.
Additional information is available on the following pages:
(this directory): Implements chromedriver commands.
chrome/: A basic interface for controlling Chrome. Should not depend on or reference WebDriver-related code or concepts.
net/: Code to deal with network communication, such as connection to DevTools.
client/: Code for a python client.
server/: Code for the chromedriver server. A python wrapper to the chromedriver server.
test/: Integration tests.
There are several test suites for verifying ChromeDriver's correctness. For details, see the testing page.
Find an open issue and submit a patch for review by an individual listed in the
OWNERS file in this directory. Issues are tracked in ChromeDriver issue tracker.