You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: files/en-us/web/webdriver/reference/bidi/modules/browser/createusercontext/index.md
+3Lines changed: 3 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -29,6 +29,9 @@ Set `params` to an empty object (`{}`) or include any of the following optional
29
29
-`unhandledPromptBehavior` {{optional_inline}}
30
30
- : 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](/en-US/docs/Web/WebDriver/Reference/BiDi/Modules/session/new#unhandledpromptbehavior)`unhandledPromptBehavior` setting for this user context.
31
31
32
+
> [!NOTE]
33
+
> When a parameter is set, it applies to all existing and future tabs within this user context.
34
+
32
35
### Return value
33
36
34
37
The following field in the `result` object of the response describes the created user context:
The **`browser`** module contains commands for managing the browser, including user contexts, client windows, and download behavior.
11
-
12
-
## User contexts
13
-
14
-
A user context is a collection of zero or more top-level contexts (tabs) within the browser. Tabs within the same user context share the same browser storage (such as cookies and session data), while tabs in different user contexts are completely isolated from one another and do not share any browser data. A user context with no tabs is called an empty user context.
15
-
16
-
Each user context has a unique string identifier (user context ID). The browser always has a default user context with the ID `"default"`, which cannot be removed.
17
-
18
-
User contexts can be created using [`browser.createUserContext`](/en-US/docs/Web/WebDriver/Reference/BiDi/Modules/browser/createUserContext) and removed using [`browser.removeUserContext`](/en-US/docs/Web/WebDriver/Reference/BiDi/Modules/browser/removeUserContext).
10
+
The **`browser`** module contains commands for managing the browser, including client windows, user contexts, and download behavior.
19
11
20
12
## Client windows
21
13
22
-
A client window is a browser window, which includes the viewport (the area where web content is displayed) and browser UI elements such as the address bar and toolbars.
14
+
A client window is an OS-level browser window, which includes the viewport (the area where web content is displayed) and browser UI elements such as the address bar and toolbars.
23
15
24
16
Each client window has the following properties:
25
17
26
-
- A unique string identifier (client window ID)
18
+
- A unique string identifier (`clientWindow`)
19
+
- A state (`state`) indicating whether the window is normal, maximized, minimized, or fullscreen.
27
20
- A position expressed as `x` and `y` coordinates in CSS pixels from the left and top edges of the screen, respectively
28
21
- A size expressed as `width` and `height` in CSS pixels
29
22
30
-
Multiple tabs from different [user contexts](#user_contexts) can share the same client window.
31
-
32
23
A list of client windows can be obtained using [`browser.getClientWindows`](/en-US/docs/Web/WebDriver/Reference/BiDi/Modules/browser/getClientWindows) and their state can be changed using [`browser.setClientWindowState`](/en-US/docs/Web/WebDriver/Reference/BiDi/Modules/browser/setClientWindowState).
33
24
25
+
## User contexts
26
+
27
+
A user context is a collection of zero or more top-level contexts (tabs) within the browser. Tabs within the same user context share the same browser storage (such as cookies and session data), while tabs in different user contexts are completely isolated from one another and do not share any browser data. A user context with no tabs is called an empty user context.
28
+
29
+
Each user context has a unique string identifier (user context ID). The browser always has a default user context with the ID `"default"`, which cannot be removed.
30
+
31
+
Multiple tabs from different user contexts can share the same [client window](#client_windows).
32
+
33
+
User contexts can be created using [`browser.createUserContext`](/en-US/docs/Web/WebDriver/Reference/BiDi/Modules/browser/createUserContext) and removed using [`browser.removeUserContext`](/en-US/docs/Web/WebDriver/Reference/BiDi/Modules/browser/removeUserContext).
The `browser.removeUserContext`[command](/en-US/docs/Web/WebDriver/Reference/BiDi/Modules#commands) of the [`browser`](/en-US/docs/Web/WebDriver/Reference/BiDi/Modules/browser) module removes the specified [user context](/en-US/docs/Web/WebDriver/Reference/BiDi/Modules/browser#user_contexts) and all its tabs across all windows. Tabs are closed without running [`beforeunload`](/en-US/docs/Web/API/Window/beforeunload_event) event handler functions.
10
+
The `browser.removeUserContext`[command](/en-US/docs/Web/WebDriver/Reference/BiDi/Modules#commands) of the [`browser`](/en-US/docs/Web/WebDriver/Reference/BiDi/Modules/browser) module removes the specified [user context](/en-US/docs/Web/WebDriver/Reference/BiDi/Modules/browser#user_contexts) and all its tabs across all windows. Tabs are closed without running the [`beforeunload`](/en-US/docs/Web/API/Window/beforeunload_event) event handler functions.
11
11
12
12
> [!WARNING]
13
13
> This command is irreversible, and all storage associated with the user context is permanently deleted.
0 commit comments