browser.createUserContext command

The browser.createUserContext command of the browser module creates a new user context in the browser.

Syntax

json
{
  "method": "browser.createUserContext",
  "params": {}
}

Parameters

Set params to an empty object ({}) or include any of the following optional fields:

acceptInsecureCerts Optional

A boolean that controls whether untrusted TLS certificates (for example, self-signed or expired) are accepted within this user context. When set, it overrides the session-level acceptInsecureCerts setting for this user context.

proxy Optional

An object that specifies the proxy configuration the browser should use for network requests within this user context. When set, it overrides the session-level proxy setting for this user context.

unhandledPromptBehavior Optional

An object that specifies the default behavior when a user prompt (such as an alert, confirm, or prompt dialog) is encountered within this user context. When set, it overrides the session-level unhandledPromptBehavior setting for this user context.

Note: When a parameter is set, it applies to all existing and future tabs within this user context.

Return value

The following field in the result object of the response describes the created user context:

userContext

A string that uniquely identifies the created user context.

Errors

unsupported operation

acceptInsecureCerts is true but the browser does not support accepting insecure TLS connections, or proxy is specified but the browser cannot configure proxy settings for this user context or cannot apply the given proxy configuration.

Examples

Creating a user context with default settings

With a WebDriver BiDi connection and an active session, send the following message to create a user context:

json
{
  "id": 1,
  "method": "browser.createUserContext",
  "params": {}
}

The browser responds with a successful user context creation as follows:

json
{
  "id": 1,
  "type": "success",
  "result": {
    "userContext": "4e4b1f6d-3f1a-4b2e-9f8c-1a2b3c4d5e6f"
  }
}

Creating a user context with a proxy

Send the following message to create a user context that routes network requests through a proxy:

json
{
  "id": 2,
  "method": "browser.createUserContext",
  "params": {
    "proxy": {
      "proxyType": "manual",
      "httpProxy": "127.0.0.1:80"
    }
  }
}

The browser responds with a successful user context creation as follows:

json
{
  "id": 2,
  "type": "success",
  "result": {
    "userContext": "7d9e2a1b-5c3f-4e6d-8a7b-2c1d0e9f8a7b"
  }
}

Specifications

Specification
WebDriver BiDi
# command-browser-createUserContext

Browser compatibility

desktop mobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
browser.createUserContext command
Chrome – Full support
Chrome 126 (Release date: 2024-06-11)
footnote Full support
Edge – Full support
Edge 126 (Release date: 2024-06-13)
footnote Full support
Firefox – Full support
Firefox 124 (Release date: 2024-03-19)
footnote Full support
Opera – Full support
Opera 112 (Release date: 2024-07-11)
footnote Full support
Safari – No support
Safari
footnote
footnote See bug 288104
Chrome Android – Full support
Chrome Android 126 (Release date: 2024-06-11)
footnote Full support
Firefox for Android – Full support
Firefox for Android 124 (Release date: 2024-03-19)
footnote Full support
Opera Android – Full support
Opera Android 83 (Release date: 2024-06-25)
footnote Full support
Safari on iOS – No support
Safari on iOS
footnote
footnote See bug 288104
Samsung Internet – Full support
Samsung Internet 28 (Release date: 2025-04-02)
footnote Full support
WebView Android – Full support
WebView Android 126 (Release date: 2024-06-11)
footnote Full support
WebView on iOS – No support
WebView on iOS
footnote
footnote See bug 288104
acceptInsecureCerts parameter
Chrome – Full support
Chrome 138 (Release date: 2025-06-24)
footnote Full support
Edge – Full support
Edge 138 (Release date: 2025-06-26)
footnote Full support
Firefox – Full support
Firefox 140 (Release date: 2025-06-24)
footnote Full support
Opera – Full support
Opera 122 (Release date: 2025-09-11)
footnote Full support
Safari – No support
Safari
footnote No support
Chrome Android – Full support
Chrome Android 138 (Release date: 2025-06-24)
footnote Full support
Firefox for Android – Full support
Firefox for Android 140 (Release date: 2025-06-24)
footnote Full support
Opera Android – Full support
Opera Android 91 (Release date: 2025-08-19)
footnote Full support
Safari on iOS – No support
Safari on iOS
footnote No support
Samsung Internet – No support
Samsung Internet
footnote No support
WebView Android – Full support
WebView Android 138 (Release date: 2025-06-24)
footnote Full support
WebView on iOS – No support
WebView on iOS
footnote No support
proxy parameter
Chrome – Full support
Chrome 138 (Release date: 2025-06-24)
footnote Full support
Edge – Full support
Edge 138 (Release date: 2025-06-26)
footnote Full support
Firefox – Full support
Firefox 141 (Release date: 2025-07-22)
footnote
footnote Only supports direct and manual proxy configurations, not autodetect, pac, and system.
Opera – Full support
Opera 122 (Release date: 2025-09-11)
footnote Full support
Safari – No support
Safari
footnote No support
Chrome Android – Full support
Chrome Android 138 (Release date: 2025-06-24)
footnote Full support
Firefox for Android – Full support
Firefox for Android 141 (Release date: 2025-07-22)
footnote
footnote Only supports direct and manual proxy configurations, not autodetect, pac, and system.
Opera Android – Full support
Opera Android 91 (Release date: 2025-08-19)
footnote Full support
Safari on iOS – No support
Safari on iOS
footnote No support
Samsung Internet – No support
Samsung Internet
footnote No support
WebView Android – Full support
WebView Android 138 (Release date: 2025-06-24)
footnote Full support
WebView on iOS – No support
WebView on iOS
footnote No support
unhandledPromptBehavior parameter
Experimental
Chrome – Full support
Chrome 140 (Release date: 2025-09-02)
footnote Full support
Edge – Full support
Edge 140 (Release date: 2025-09-05)
footnote Full support
Firefox – No support
Firefox
footnote
footnote See bug 1975279
Opera – Full support
Opera 124 (Release date: 2025-11-13)
footnote Full support
Safari – No support
Safari
footnote No support
Chrome Android – Full support
Chrome Android 140 (Release date: 2025-09-02)
footnote Full support
Firefox for Android – No support
Firefox for Android
footnote
footnote See bug 1975279
Opera Android – Full support
Opera Android 92 (Release date: 2025-10-08)
footnote Full support
Safari on iOS – No support
Safari on iOS
footnote No support
Samsung Internet – No support
Samsung Internet
footnote No support
WebView Android – Full support
WebView Android 140 (Release date: 2025-09-02)
footnote Full support
WebView on iOS – No support
WebView on iOS
footnote No support

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support
Experimental. Expect behavior to change in the future.
See implementation notes.

See also