MDN self-hosted library · e01.org

`browsingContext.activate` command

The browsingContext.activate command of the browsingContext module brings a top-level context to the foreground and gives it focus.

no runnable cells webdriver-command upstream source

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": "93ee5bd6-d256-4608-a002-9a8995cc0e5f"
  }
}

Parameters

The params field contains:

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 context is 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

Browser compatibility

See also