tree: 258575907c95c08a181c81d1cb2b1129cc4838e9 [path history] [tgz]
  1. BUILD.gn
  2. DEPS
  3. DIR_METADATA
  4. OWNERS
  5. README.md
  6. alert_commands.cc
  7. alert_commands.h
  8. basic_types.cc
  9. basic_types.h
  10. capabilities.cc
  11. capabilities.h
  12. capabilities_unittest.cc
  13. chrome/
  14. chrome_launcher.cc
  15. chrome_launcher.h
  16. chrome_launcher_unittest.cc
  17. chrome_paths.py
  18. client/
  19. command.h
  20. command_listener.h
  21. command_listener_proxy.cc
  22. command_listener_proxy.h
  23. command_listener_proxy_unittest.cc
  24. commands.cc
  25. commands.h
  26. commands_unittest.cc
  27. connection_session_map.h
  28. constants/
  29. cpp_source.py
  30. devtools_events_logger.cc
  31. devtools_events_logger.h
  32. docs/
  33. element_commands.cc
  34. element_commands.h
  35. element_commands_unittest.cc
  36. element_util.cc
  37. element_util.h
  38. embed_js_in_cpp.py
  39. embed_mobile_devices_in_cpp.py
  40. embed_networks_in_cpp.py
  41. embed_user_data_dir_in_cpp.py
  42. js/
  43. key_converter.cc
  44. key_converter.h
  45. key_converter_unittest.cc
  46. keycode_text_conversion.h
  47. keycode_text_conversion_mac.mm
  48. keycode_text_conversion_ozone.cc
  49. keycode_text_conversion_unittest.cc
  50. keycode_text_conversion_win.cc
  51. keycode_text_conversion_x.cc
  52. log_replay/
  53. logging.cc
  54. logging.h
  55. logging_unittest.cc
  56. net/
  57. performance_logger.cc
  58. performance_logger.h
  59. performance_logger_unittest.cc
  60. server/
  61. session.cc
  62. session.h
  63. session_commands.cc
  64. session_commands.h
  65. session_commands_unittest.cc
  66. session_connection_map.h
  67. session_thread_map.h
  68. session_unittest.cc
  69. support/
  70. test/
  71. util.cc
  72. util.h
  73. util.py
  74. util_unittest.cc
  75. webauthn_commands.cc
  76. webauthn_commands.h
  77. window_commands.cc
  78. window_commands.h
  79. window_commands_unittest.cc
chrome/test/chromedriver/README.md

ChromeDriver

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.

Getting Started

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 chromedriver[.exe].

Once built, ChromeDriver can be used with various third-party libraries that support WebDriver protocol, including language bindings provided by Selenium.

Verifying the Build

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())
>>> 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. The path to adb_commands.py and the adb tool from the Android SDK must be set in PATH. For more detailed instructions see the user site.

Architecture

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:

Code structure (relative to this file)

  • (this directory): Implements chromedriver commands.

  • chrome/: A basic interface for controlling Chrome. Should not depend on or reference WebDriver-related code or concepts.

  • js/: Javascript helper scripts.

  • 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.

  • extension/: An extension used for automating the desktop browser.

  • test/: Integration tests.

Testing

There are several test suites for verifying ChromeDriver's correctness. For details, see the testing page.

Contributing

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.