This is the multi-page printable view of this section. Click here to print.

Return to the regular view of this page.

BiDirectional API (W3C compliant)

Examples of working with Chrome DevTools Protocol in Selenium. CDP support is temporary until WebDriver BiDi has been implemented.

The following list of APIs will be growing as the WebDriver BiDirectional Protocol grows and browser vendors implement the same. Additionally, Selenium will try to support real-world use cases that internally use a combination of W3C BiDi protocol APIs.

If there is additional functionality you’d like to see, please raise a feature request.

1 - Browsing Context

Commands

This section contains the APIs related to browsing context commands.

Open a new window

Creates a new browsing context in a new window.

Selenium v4.8

Selenium v4.8

Open a new tab

Creates a new browsing context in a new tab.

Selenium v4.8

Selenium v4.8

Use existing window handle

Creates a browsing context for the existing tab/window to run commands.

Selenium v4.8

Selenium v4.8

Open a window with a reference browsing context

A reference browsing context is a top-level browsing context. The API allows to pass the reference browsing context, which is used to create a new window. The implementation is operating system specific.

Selenium v4.8

Selenium v4.8

Open a tab with a reference browsing context

A reference browsing context is a top-level browsing context. The API allows to pass the reference browsing context, which is used to create a new tab. The implementation is operating system specific.

Selenium v4.8

Selenium v4.8

Selenium v4.8

Selenium v4.8

Selenium v4.8

Selenium v4.8

Get browsing context tree

Provides a tree of all browsing contexts descending from the parent browsing context, including the parent browsing context.

Selenium v4.8

Selenium v4.8

Get browsing context tree with depth

Provides a tree of all browsing contexts descending from the parent browsing context, including the parent browsing context upto the depth value passed.

Selenium v4.8

Selenium v4.8

Get All Top level browsing contexts

Selenium v4.8

Selenium v4.20.0

Close a tab/window

Selenium v4.8

Selenium v4.8

Activate a browsing context

Selenium v4.14.1

Selenium v4.15

Reload a browsing context

Selenium v4.13.0

Selenium v4.15

Handle user prompt

Selenium v4.13.0

Selenium v4.15

Capture Screenshot

Selenium v4.13.0

Selenium v4.15

Capture Viewport Screenshot

Selenium v4.14.0

Selenium v4.15

Capture Element Screenshot

Selenium v4.14.0

Selenium v4.15

Set Viewport

Selenium v4.14.1

Selenium v4.15

Selenium v4.14.1

Selenium v4.10

Selenium v4.16.0

Selenium v4.17

Selenium v4.16.0

Selenium v4.17

Traverse history

Selenium v4.16.0

Selenium v4.17

Events

This section contains the APIs related to browsing context events.

Browsing Context Created Event

Selenium v4.10

Selenium v4.9.2

Dom Content loaded Event

Selenium v4.10

Selenium v4.9.2

Browsing Context Loaded Event

Selenium v4.10

Selenium v4.9.2

Selenium v4.15

Fragment Navigated Event

Selenium v4.15

Selenium v4.15.0

User Prompt Opened Event

Selenium v4.15

User Prompt Closed Event

Selenium v4.15

Browsing Context Destroyed Event

Selenium v4.18

Selenium v4.18.0

2 - Input

This section contains the APIs related to input commands.

Perform Actions

Selenium v4.17

Selenium v4.17

Release Actions

Selenium v4.17

Selenium v4.17

3 - Log

This section contains the APIs related to logging.

Console logs

Listen to the console.log events and register callbacks to process the event.

Selenium v4.8

JavaScript exceptions

Listen to the JS Exceptions and register callbacks to process the exception details.

Listen to JS Logs

Listen to all JS logs at all levels and register callbacks to process the log.

Selenium v4.8

4 - Network

Commands

This section contains the APIs related to network commands.

Add network intercept

Selenium v4.18

Selenium v4.18

Remove network intercept

Selenium v4.18

Selenium v4.18

Continue request blocked at authRequired phase with credentials

Selenium v4.18

Selenium v4.18

Continue request blocked at authRequired phase without credentials

Selenium v4.18

Selenium v4.18

Cancel request blocked at authRequired phase

Selenium v4.18

Selenium v4.18

Fail request

Selenium v4.18

Events

This section contains the APIs related to network events.

Before Request Sent

Selenium v4.15

Selenium v4.18

Response Started

Selenium v4.15

Selenium v4.18

Response Completed

Selenium v4.15

Selenium v4.18

Auth Required

Selenium v4.17

5 - Script

Commands

This section contains the APIs related to script commands.

Call function in a browsing context

Selenium v4.15

Selenium v4.9

Call function in a sandbox

Selenium v4.15

Selenium v4.9

Call function in a realm

Selenium v4.15

Selenium v4.9

Evaluate script in a browsing context

Selenium v4.15

Selenium v4.9

Evaluate script in a sandbox

Selenium v4.15

Selenium v4.9

Evaluate script in a realm

Selenium v4.15

Selenium v4.9

Disown handles in a browsing context

Selenium v4.15

Selenium v4.9

Disown handles in a realm

Selenium v4.15

Selenium v4.9

Get all realms

Selenium v4.15

Selenium v4.9

Get realm by type

Selenium v4.15

Selenium v4.9

Get browsing context realms

Selenium v4.15

Selenium v4.9

Get browsing context realms by type

Selenium v4.15

Selenium v4.9

Preload a script

Selenium v4.15

Selenium v4.10

Remove a preloaded script

Selenium v4.15

Selenium v4.10

Events

This section contains the APIs related to script events.

Message

Selenium v4.16

Selenium v4.18

Realm Created

Selenium v4.16

Selenium v4.18

Realm Destroyed

Selenium v4.16

Selenium v4.19