selenium.webdriver.chromium.webdriver

class selenium.webdriver.chromium.webdriver.ChromiumDriver(browser_name, vendor_prefix, port=0, options: selenium.webdriver.common.options.BaseOptions = None, service_args=None, desired_capabilities=None, service_log_path=None, service: selenium.webdriver.common.service.Service = None, keep_alive=None)[source]

Controls the WebDriver instance of ChromiumDriver and allows you to drive the browser.

Creates a new WebDriver instance of the ChromiumDriver. Starts the service and then creates new WebDriver instance of ChromiumDriver.

Args:
  • browser_name - Browser name used when matching capabilities.
  • vendor_prefix - Company prefix to apply to vendor-specific WebDriver extension commands.
  • port - Deprecated: port you would like the service to run, if left as 0, a free port will be found.
  • options - this takes an instance of ChromiumOptions
  • service_args - Deprecated: List of args to pass to the driver service
  • desired_capabilities - Deprecated: Dictionary object with non-browser specific capabilities only, such as “proxy” or “loggingPref”.
  • service_log_path - Deprecated: Where to log information from the driver.
  • keep_alive - Deprecated: Whether to configure ChromiumRemoteConnection to use HTTP keep-alive.
create_options() → selenium.webdriver.common.options.BaseOptions[source]
execute_cdp_cmd(cmd: str, cmd_args: dict)[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 https://chromedevtools.github.io/devtools-protocol/

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’}

get_issue_message()[source]
Returns:An error message when there is any issue in a Cast session.
get_network_conditions()[source]

Gets Chromium network emulation settings.

Returns:A dict. For example: {‘latency’: 4, ‘download_throughput’: 2, ‘upload_throughput’: 2, ‘offline’: False}
get_sinks() → list[source]
Returns:A list of sinks avaliable for Cast.
launch_app(id)[source]

Launches Chromium app specified by id.

quit() → NoReturn[source]

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

set_network_conditions(**network_conditions) → NoReturn[source]

Sets Chromium network emulation settings.

Args:
  • network_conditions: A dict with conditions specification.
Usage:
driver.set_network_conditions(
    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).

set_sink_to_use(sink_name: str) → str[source]

Sets a specific sink, using its name, as a Cast session receiver target.

Args:
  • sink_name: Name of the sink to use as the target.
start_tab_mirroring(sink_name: str) → str[source]

Starts a tab mirroring session on a specific receiver target.

Args:
  • sink_name: Name of the sink to use as the target.
stop_casting(sink_name: str) → str[source]

Stops the existing Cast session on a specific receiver target.

Args:
  • sink_name: Name of the sink to stop the Cast session.