browsingContext.activate command
The browsingContext.activate command of the browsingContext module brings a top-level context to the foreground and gives it focus.
Syntax
{
"method": "browsingContext.activate",
"params": {
"context": "<contextId>"
}
}
Parameters
The params field contains:
context-
A string that contains the ID of the top-level context to bring to the foreground and give focus. Context IDs are returned by commands such as
browsingContext.getTree.
Return value
The result field in the response is an empty object ({}).
Errors
invalid argument-
A required parameter is missing or has an invalid type. This error is also returned when the context specified by
contextis not a top-level context. no such frame-
No context with the given context ID is found.
unsupported operation-
The browser cannot bring the context to the foreground.
Examples
>Activating a background tab
The following example shows how to activate a background tab.
With a WebDriver BiDi connection and an active session, suppose you create a tab in the background using browsingContext.create with background: true, which returns the context ID of the tab. Send the following message to activate it:
{
"id": 1,
"method": "browsingContext.activate",
"params": {
"context": "5e5e96e8-5247-4f22-9b35-a4a2d841cbaa"
}
}
The browser brings the tab to the foreground and responds as follows:
{
"id": 1,
"type": "success",
"result": {}
}
Specifications
| Specification |
|---|
| WebDriver BiDi> # command-browsingContext-activate> |
Browser compatibility
See also
browsingContext.closecommandbrowsingContext.createcommandbrowsingContext.getTreecommand