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.
10
+
The **`browser`** module contains commands for managing the browser, including client windows, user contexts, and download behavior.
11
11
12
-
## User contexts
12
+
## Client windows
13
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.
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.
15
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.
16
+
Each client window has the following properties:
17
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).
18
+
- A unique string identifier (`clientWindow`).
19
+
- A state (`state`) indicating whether the window is normal, maximized, minimized, or fullscreen.
20
+
- An active state (`active`) indicating whether the window can receive keyboard input from the operating system.
21
+
- A position expressed as `x` and `y` coordinates in CSS pixels from the left and top edges of the screen, respectively.
22
+
- A size expressed as `width` and `height` in CSS pixels.
19
23
20
-
## Client windows
24
+
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).
21
25
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.
26
+
## User contexts
23
27
24
-
Each client window has the following properties:
28
+
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.
25
29
26
-
- A unique string identifier (client window ID)
27
-
- A position expressed as `x` and `y` coordinates in CSS pixels from the left and top edges of the screen, respectively
28
-
- A size expressed as `width` and `height` in CSS pixels
30
+
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.
29
31
30
-
Multiple tabs from different [user contexts](#user_contexts) can share the same client window.
32
+
Multiple tabs from different user contexts can share the same [client window](#client_windows).
31
33
32
-
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).
34
+
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