Chrome Driver Binary
All ChromeOS test images shall have Chrome Driver binary installed in /usr/local/chromedriver/. The binary is updated to the same version of Chrome in that test image. That is, you will always be using the latest build of Chrome Driver.
If your test expects to run against a “stable” build of Chrome Driver binary, you will need to write your own code in your test to download the desired binary and replace the binary in /usr/local/chromedriver/.
How to use Chrome Driver in an Autotest test
Writing a test that uses Chrome Driver to interact with Chrome is easy. There is a wrapper class for using Chrome Driver available in ChromeOS/Autotest. The wrapper class, as a context manager type, and handles the following tasks for you:
Logs in ChromeOS using Telemetry.
Starts Chrome Driver with Remote mode on the Device under Test (DUT) and connects to the remote debug port of the Chrome instance after log in.
Exposes a driver instance for you to make any Chrome Driver calls.
Shutdowns Chrome Driver process, and logs out of ChromeOS.
To write a test, you can follow the example of test desktopui_UrlFetchWithChromeDriver. All you need to do to get started are basically:
import the wrapper class
from autotest_lib.client.common_lib.cros import chromedriver
2. Create an instance of the Chrome Driver, and make calls.
with chromedriver.chromedriver() as chromedriver_instance:
driver = chromedriver_instance.driver
# Here you can make standard Chrome Driver calls through the driver instance.
# For example, browse a given url with |driver.get(url)|