Chrome DevTools Protocol Endpoint
Google provides a
/cdp/execute
endpoint that can be accessed directly. Each Selenium binding provides a method that allows you to pass the CDP domain as a String, and the required parameters as a simple Map.These methods will eventually be removed. It is recommended to use the WebDriver-BiDi or WebDriver Bidi APIs methods where possible to ensure future compatibility.
Usage
Generally you should prefer the use of the CDP API over this approach, but sometimes the syntax is cleaner or significantly more simple.
Limitations include:
- It only works for use cases that are limited to setting or getting information; any actual asynchronous interactions require another implementation
- You have to know the exactly correct “magic strings” for domains and keys
- It is possible that an update to Chrome will change the required parameters
Examples
Set Cookie
An alternate implementation can be found at CDP API Set Cookie
Performance Metrics
An alternate implementation can be found at CDP API Performance Metrics
Basic authentication
Alternate implementations can be found at CDP API Basic Authentication and BiDi API Basic Authentication