-
Notifications
You must be signed in to change notification settings - Fork 23.2k
[Editorial review] BiDi - Add pages for browser module commands #43518
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
5c5d399
browser get, create usercontext commands
dipikabh 44953b4
update landing page and sidebar
dipikabh 7074265
pages for browser removeusercontext, close commands
dipikabh cd25adb
adds browser getclientwindows page
dipikabh dbd16d3
addresses review feedback
dipikabh abe6fe5
Apply suggestions from code review
dipikabh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
75 changes: 75 additions & 0 deletions
75
files/en-us/web/webdriver/reference/bidi/modules/browser/close/index.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| --- | ||
| title: browser.close command | ||
| short-title: browser.close | ||
| slug: Web/WebDriver/Reference/BiDi/Modules/browser/close | ||
| page-type: webdriver-command | ||
| browser-compat: webdriver.bidi.browser.close | ||
| sidebar: webdriver | ||
| --- | ||
|
|
||
| The `browser.close` [command](/en-US/docs/Web/WebDriver/Reference/BiDi/Modules#commands) of the [`browser`](/en-US/docs/Web/WebDriver/Reference/BiDi/Modules/browser) module closes the browser and ends all active WebDriver sessions. Tabs are closed without running [`beforeunload`](/en-US/docs/Web/API/Window/beforeunload_event) event handler functions. The response is sent before the WebSocket connection is closed. | ||
|
|
||
| ## Syntax | ||
|
|
||
| ```json-nolint | ||
| { | ||
| "method": "browser.close", | ||
| "params": {} | ||
| } | ||
| ``` | ||
|
|
||
| ### Parameters | ||
|
|
||
| None. However, you must include the `params` field and set it to an empty object (`{}`). | ||
|
|
||
| ### Return value | ||
|
|
||
| The `result` field in the response is an empty object (`{}`). | ||
|
|
||
| ### Errors | ||
|
|
||
| - `unable to close browser` | ||
| - : There are other active WebDriver sessions open at the time the command is sent. | ||
| Browsers may return this error before continuing to close. | ||
|
|
||
| ## Examples | ||
|
|
||
| ### Closing the browser | ||
|
|
||
| With a [WebDriver BiDi connection](/en-US/docs/Web/WebDriver/How_to/Create_BiDi_connection) and an [active session](/en-US/docs/Web/WebDriver/Reference/BiDi/Modules/session/new), send the following message to close the browser: | ||
|
|
||
| ```json | ||
| { | ||
| "id": 1, | ||
| "method": "browser.close", | ||
| "params": {} | ||
| } | ||
| ``` | ||
|
|
||
| Before closing, the browser responds successfully as shown here: | ||
|
|
||
| ```json | ||
| { | ||
| "id": 1, | ||
| "type": "success", | ||
| "result": {} | ||
| } | ||
| ``` | ||
|
|
||
| After the response, the WebSocket connection closes as the browser shuts down. | ||
|
|
||
| ## Specifications | ||
|
|
||
| {{Specifications}} | ||
|
|
||
| ## Browser compatibility | ||
|
|
||
| {{Compat}} | ||
|
|
||
| ## See also | ||
|
|
||
| - [`session.new`](/en-US/docs/Web/WebDriver/Reference/BiDi/Modules/session/new) command | ||
| - [`session.end`](/en-US/docs/Web/WebDriver/Reference/BiDi/Modules/session/end) command | ||
| - [`browser.createUserContext`](/en-US/docs/Web/WebDriver/Reference/BiDi/Modules/browser/createUserContext) command | ||
| - [`browser.getUserContexts`](/en-US/docs/Web/WebDriver/Reference/BiDi/Modules/browser/getUserContexts) command | ||
| - [`browser.removeUserContext`](/en-US/docs/Web/WebDriver/Reference/BiDi/Modules/browser/removeUserContext) command |
114 changes: 114 additions & 0 deletions
114
...s/en-us/web/webdriver/reference/bidi/modules/browser/createusercontext/index.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,114 @@ | ||
| --- | ||
| title: browser.createUserContext command | ||
| short-title: browser.createUserContext | ||
| slug: Web/WebDriver/Reference/BiDi/Modules/browser/createUserContext | ||
| page-type: webdriver-command | ||
| browser-compat: webdriver.bidi.browser.createUserContext | ||
| sidebar: webdriver | ||
| --- | ||
|
|
||
| The `browser.createUserContext` [command](/en-US/docs/Web/WebDriver/Reference/BiDi/Modules#commands) of the [`browser`](/en-US/docs/Web/WebDriver/Reference/BiDi/Modules/browser) module creates a new [user context](/en-US/docs/Web/WebDriver/Reference/BiDi/Modules/browser#user_contexts) in the browser. | ||
|
|
||
| ## Syntax | ||
|
|
||
| ```json-nolint | ||
| { | ||
| "method": "browser.createUserContext", | ||
| "params": {} | ||
| } | ||
| ``` | ||
|
|
||
| ### Parameters | ||
|
|
||
| Set `params` to an empty object (`{}`) or include any of the following optional fields: | ||
|
|
||
| - [`acceptInsecureCerts`](/en-US/docs/Web/WebDriver/Reference/Capabilities/acceptInsecureCerts) {{optional_inline}} | ||
| - : 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](/en-US/docs/Web/WebDriver/Reference/BiDi/Modules/session/new#acceptinsecurecerts) `acceptInsecureCerts` setting for this user context. | ||
| - `proxy` {{optional_inline}} | ||
| - : 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](/en-US/docs/Web/WebDriver/Reference/BiDi/Modules/session/new#proxy) `proxy` setting for this user context. | ||
| - `unhandledPromptBehavior` {{optional_inline}} | ||
| - : 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. | ||
whimboo marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| > [!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](/en-US/docs/Web/WebDriver/How_to/Create_BiDi_connection) and an [active session](/en-US/docs/Web/WebDriver/Reference/BiDi/Modules/session/new), 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 | ||
|
|
||
| {{Specifications}} | ||
|
|
||
| ## Browser compatibility | ||
|
|
||
| {{Compat}} | ||
|
|
||
| ## See also | ||
|
|
||
| - [`session.new`](/en-US/docs/Web/WebDriver/Reference/BiDi/Modules/session/new) command | ||
| - [`browser.getUserContexts`](/en-US/docs/Web/WebDriver/Reference/BiDi/Modules/browser/getUserContexts) command | ||
| - [`browser.removeUserContext`](/en-US/docs/Web/WebDriver/Reference/BiDi/Modules/browser/removeUserContext) command | ||
137 changes: 137 additions & 0 deletions
137
files/en-us/web/webdriver/reference/bidi/modules/browser/getclientwindows/index.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,137 @@ | ||
| --- | ||
| title: browser.getClientWindows command | ||
| short-title: browser.getClientWindows | ||
| slug: Web/WebDriver/Reference/BiDi/Modules/browser/getClientWindows | ||
| page-type: webdriver-command | ||
| browser-compat: webdriver.bidi.browser.getClientWindows | ||
| sidebar: webdriver | ||
| --- | ||
|
|
||
| The `browser.getClientWindows` [command](/en-US/docs/Web/WebDriver/Reference/BiDi/Modules#commands) of the [`browser`](/en-US/docs/Web/WebDriver/Reference/BiDi/Modules/browser) module returns a list of [client windows](/en-US/docs/Web/WebDriver/Reference/BiDi/Modules/browser#client_windows). | ||
whimboo marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| ## Syntax | ||
|
|
||
| ```json-nolint | ||
| { | ||
| "method": "browser.getClientWindows", | ||
| "params": {} | ||
| } | ||
| ``` | ||
|
|
||
| ### Parameters | ||
|
|
||
| None. However, you must include the `params` field and set it to an empty object (`{}`). | ||
|
|
||
| ### Return value | ||
|
|
||
| The following field in the `result` object of the response describes the client windows in the browser: | ||
|
|
||
| - `clientWindows` | ||
| - : An array of objects, each representing a client window. | ||
| The array may be empty if the browser has no open windows. | ||
| Each object has the following fields: | ||
| - `active` | ||
| - : A boolean that indicates whether the client window can receive keyboard input from the operating system. | ||
| This can mean a tab within the window has system focus, or the browser UI itself is focused. | ||
| - `clientWindow` | ||
| - : A string that uniquely identifies the client window. | ||
| - `height` | ||
| - : A number that indicates the height of the window in CSS pixels. | ||
dipikabh marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| - `state` | ||
| - : A string that indicates the current state of the window. | ||
| - `"fullscreen"` | ||
| - : Indicates that the window is in fullscreen mode. | ||
| - `"maximized"` | ||
| - : Indicates that the window is maximized to fill the screen area. | ||
| - `"minimized"` | ||
| - : Indicates that the window is minimized (hidden from view). | ||
| - `"normal"` | ||
| - : Indicates that the window is in its normal (restored) state. | ||
| - `width` | ||
| - : A number that indicates the width of the window in CSS pixels. | ||
dipikabh marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| - `x` | ||
| - : A number that indicates the x-coordinate of the window in CSS pixels, measured from the left edge of the screen area. | ||
dipikabh marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| - `y` | ||
| - : A number that indicates the y-coordinate of the window in CSS pixels, measured from the top edge of the screen area. | ||
dipikabh marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ## Examples | ||
|
|
||
| ### Getting all client windows | ||
|
|
||
| With a [WebDriver BiDi connection](/en-US/docs/Web/WebDriver/How_to/Create_BiDi_connection) and an [active session](/en-US/docs/Web/WebDriver/Reference/BiDi/Modules/session/new), send the following message to retrieve all client windows: | ||
|
|
||
| ```json | ||
| { | ||
| "id": 1, | ||
| "method": "browser.getClientWindows", | ||
| "params": {} | ||
| } | ||
| ``` | ||
|
|
||
| The browser responds successfully with the list of client windows as follows: | ||
|
|
||
| ```json | ||
| { | ||
| "id": 1, | ||
| "type": "success", | ||
| "result": { | ||
| "clientWindows": [ | ||
| { | ||
| "active": true, | ||
| "clientWindow": "09a7bf22-c52d-4011-88ad-507a7e0012c7", | ||
| "height": 970, | ||
| "state": "normal", | ||
| "width": 1280, | ||
| "x": 4, | ||
| "y": 38 | ||
| } | ||
| ] | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| ### Getting client windows when multiple browser windows are open | ||
|
|
||
| When multiple browser windows are open, the browser responds with one entry per window as follows: | ||
|
|
||
| ```json | ||
| { | ||
| "id": 2, | ||
| "type": "success", | ||
| "result": { | ||
| "clientWindows": [ | ||
| { | ||
| "active": true, | ||
| "clientWindow": "09a7bf22-c52d-4011-88ad-507a7e0012c7", | ||
| "height": 800, | ||
| "state": "normal", | ||
| "width": 1280, | ||
| "x": 0, | ||
| "y": 26 | ||
| }, | ||
| { | ||
| "active": false, | ||
| "clientWindow": "b3f8a1e5-d4c2-4e9f-8b3a-1f2e3d4c5b6a", | ||
| "height": 0, | ||
| "state": "minimized", | ||
| "width": 0, | ||
| "x": 0, | ||
| "y": 0 | ||
| } | ||
| ] | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| ## Specifications | ||
|
|
||
| {{Specifications}} | ||
|
|
||
| ## Browser compatibility | ||
|
|
||
| {{Compat}} | ||
|
|
||
| ## See also | ||
|
|
||
| - [`session.new`](/en-US/docs/Web/WebDriver/Reference/BiDi/Modules/session/new) command | ||
| - [`browser.setClientWindowState`](/en-US/docs/Web/WebDriver/Reference/BiDi/Modules/browser/setClientWindowState) command | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.