class'chromedriver', port=0, options=None, service_args=None, desired_capabilities=None, service_log_path=None, chrome_options=None)[source]

Controls the ChromeDriver and allows you to drive the browser.

You will need to download the ChromeDriver executable from

Creates a new instance of the chrome driver.

Starts the service and then creates new instance of chrome driver.

Args :
  • executable_path - path to the executable. If the default is used it assumes the executable is in the $PATH
  • port - port you would like the service to run, if left as 0, a free port will be found.
  • desired_capabilities: Dictionary object with non-browser specific capabilities only, such as “proxy” or “loggingPref”.
  • options: this takes an instance of ChromeOptions
execute_cdp_cmd(cmd, cmd_args)[source]

Execute Chrome Devtools Protocol command and get returned result

The command and command args should follow chrome devtools protocol domains/commands, refer to link

Args :
  • cmd: A str, command name
  • cmd_args: A dict, command args. empty dict {} if there is no command args
Usage :

driver.execute_cdp_cmd(‘Network.getResponseBody’, {‘requestId’: requestId})

Returns :

A dict, empty dict {} if there is no result to return. For example to getResponseBody:

{‘base64Encoded’: False, ‘body’: ‘response body string’}


Gets Chrome network emulation settings.

Returns :

A dict. For example:

{‘latency’: 4, ‘download_throughput’: 2, ‘upload_throughput’: 2, ‘offline’: False}


Launches Chrome app specified by id.


Closes the browser and shuts down the ChromeDriver executable that is started when starting the ChromeDriver


Sets Chrome network emulation settings.

Args :
  • network_conditions: A dict with conditions specification.
Usage :

offline=False, latency=5, # additional latency (ms) download_throughput=500 * 1024, # maximal throughput upload_throughput=500 * 1024) # maximal throughput

Note: ‘throughput’ can be used to set both (for download and upload).

This Page