1 This file contains high-level info about how ChromeDriver works and how to 2 contribute. 3 4 ChromeDriver is an implementation of the WebDriver standard, 5 which allows users to automate testing of their website across browsers. 6 7 See the user site at https://sites.google.com/a/chromium.org/chromedriver/ 8 9 =====Getting started===== 10 Build ChromeDriver by building the 'chromedriver' target. This will 11 create an executable binary in the build folder named 12 'chromedriver[.exe]'. 13 14 Once built, ChromeDriver can be used interactively with python. 15 16 $ export PYTHONPATH=<THIS_DIR>/server:<THIS_DIR>/client 17 $ python 18 >>> import server 19 >>> import chromedriver 20 >>> cd_server = server.Server('/path/to/chromedriver/executable') 21 >>> driver = chromedriver.ChromeDriver(cd_server.GetUrl()) 22 >>> driver.Load('http://www.google.com') 23 >>> driver.Quit() 24 >>> cd_server.Kill() 25 26 ChromeDriver will use the system installed Chrome by default. 27 28 To use ChromeDriver2 with Chrome on Android pass the Android package name in the 29 chromeOptions.androidPackage capability when creating the driver. The path to 30 adb_commands.py and the adb tool from the Android SDK must be set in PATH. For 31 more detailed instructions see the user site. 32 33 =====Architecture===== 34 ChromeDriver is shipped separately from Chrome. It controls Chrome out of 35 process through DevTools. ChromeDriver is a standalone server which 36 communicates with the WebDriver client via the WebDriver wire protocol, which 37 is essentially synchronous JSON commands over HTTP. WebDriver clients are 38 available in many languages, and many are available from the open source 39 selenium/webdriver project: http://code.google.com/p/selenium. ChromeDriver 40 uses the webserver from net/server. 41 42 ChromeDriver has a main thread, called the command thread, an IO thread, 43 and a thread per session. The webserver receives a request on the IO thread, 44 which is sent to a handler on the command thread. The handler executes the 45 appropriate command function, which completes asynchronously. The create 46 session command may create a new thread for subsequent session-related commands, 47 which will execute on the dedicated session thread synchronously. When a 48 command is finished, it will invoke a callback, which will eventually make its 49 way back to the IO thread as a HTTP response for the server to send. 50 51 =====Code structure (relative to this file)===== 52 1) . 53 Implements chromedriver commands. 54 55 2) chrome/ 56 A basic interface for controlling Chrome. Should not depend on or reference 57 WebDriver-related code or concepts. 58 59 3) js/ 60 Javascript helper scripts. 61 62 4) net/ 63 Code to deal with network communication, such as connection to DevTools. 64 65 5) client/ 66 Code for a python client. 67 68 6) server/ 69 Code for the chromedriver server. 70 A python wrapper to the chromedriver server. 71 72 7) extension/ 73 An extension used for automating the desktop browser. 74 75 8) test/ 76 Integration tests. 77 78 9) third_party/ 79 Third party libraries used by chromedriver. 80 81 =====Testing===== 82 See the ChromeDriver waterfall at: 83 http://build.chromium.org/p/chromium.chromedriver/waterfall 84 There are 4 test suites for verifying ChromeDriver's correctness: 85 86 1) chromedriver_unittests (chrome/chrome_tests.gypi) 87 This is the unittest target, which runs on the main waterfall on win/mac/linux 88 and can close the tree. It is also run on the commit queue and try bots by 89 default. Tests should take a few milliseconds and be very stable. 90 91 2) chromedriver_tests (chrome/chrome_tests.gypi) 92 This is a collection of C++ medium sized tests which can be run optionally 93 on the trybots. 94 95 3) python integration tests 96 Run test/run_py_tests.py --help for more info. These are only run on the 97 ChromeDriver waterfall. 98 99 4) WebDriver Java acceptance tests 100 These are integration tests from the WebDriver open source project which can 101 be run via test/run_java_tests.py. They are only run on the ChromeDriver 102 bots. Run with --help for more info. 103 104 =====Contributing===== 105 Find an open issue and submit a patch for review by an individual listed in 106 the OWNERS file in this directory. Issues are tracked in chromedriver's issue 107 tracker: 108 https://code.google.com/p/chromedriver/issues/list 109