browsingContext module
The browsingContext module contains commands and events for managing contexts.
Contexts
A context is a navigable that can load a document, such as a tab, an iframe, or a popup. Each context has a unique string identifier called a context ID that is used to reference it across commands and events.
There are two types of contexts:
- Top-level context
-
This type of context has no parent, corresponding to a browser tab or a standalone window. Top-level contexts belong to a user context and live inside a client window.
- Child context
-
This type of context is nested inside a top-level context, such as an
<iframe>. Child contexts are returned as children of their parent bybrowsingContext.getTree.
For example, if you open a browser window and navigate to https://example.com, that creates one top-level context with its own context ID.
If that page contains an <iframe> loading https://other.com, that creates a child context nested under the top-level context.
Opening a new tab creates a second top-level context with its own context ID.
Calling browsingContext.getTree would return both top-level contexts, with the first one having a child context.
Commands
Specifications
| Specification |
|---|
| WebDriver BiDi> # module-browsingContext> |