Browser methods, browser sessions serve 4, phone sessions 0 and computer sessions 4. A method marked not served answers StrategyUnavailable on that kind of session; check the handshake’s capabilities before relying on one.
Browser.getVersion
Browser: served
Phone: not served
Computer: served
The browser’s product name, version and user agent, as the build reports them.
| Field | Type | Description |
|---|---|---|
product | string | |
version | string | |
userAgent | string |
Browser.setPermission
Browser: not served
Phone: not served
Computer: not served
Pre-answer a site permission for this session: granted, denied, or prompt to reset it. A permission nobody set behaves as in a fresh browser profile (prompt); if a page asks, the prompt is dismissed, as a person closing it would, and the state stays prompt.
| Param | Type | Required | Description |
|---|---|---|---|
origin | string | Yes | e.g. “https://example.com”. |
permission | string | Yes | One of geolocation, notifications, camera, microphone, clipboardRead, clipboardWrite, midi, storageAccess. |
setting | string | Yes | One of granted, denied, prompt. |
idempotencyKey | string | No | Makes a re-send after a reconnect safe: a repeated key returns the recorded response without acting again. See Idempotency keys. |
{}.
Browser.readDownload
Browser: served
Phone: not served
Computer: served
Read a completed download’s bytes (Page.waitForDownload’s downloadId), length bytes from offset: 1 MiB by default, at most 4 MiB. Read on from nextOffset until it is absent.
| Param | Type | Required | Description |
|---|---|---|---|
downloadId | string | Yes | |
offset | integer | No | |
length | integer | No | Bytes to read; 0 means 1 MiB. From 0 to 4194304. |
| Field | Type | Description |
|---|---|---|
contentBase64 | string | |
sizeBytes | integer | The whole download’s size. |
nextOffset | integer | Where the next piece starts; absent after the last. |
Browser.stageUpload
Browser: served
Phone: not served
Computer: served
Write a file into the session’s upload folder for Locator.setInputFiles to pick by name. One command carries at most about 128 KiB of content, so a larger file goes in several calls with append; the first call (without append) replaces anything staged under the name. A file is limited to 32 MiB.
| Param | Type | Required | Description |
|---|---|---|---|
name | string | Yes | A plain file name, such as “report.pdf”; no folders. |
contentBase64 | string | Yes | The bytes to write |
append | boolean | No | Add to what is already staged under name instead of replacing it. |
| Field | Type | Description |
|---|---|---|
name | string | |
sizeBytes | integer | The staged file’s size so far. |
Browser.setViewport
Browser: served
Phone: not served
Computer: served
Resize the browser window so the page’s viewport is width by height CSS pixels, for every tab. A size larger than the monitor allows (less the browser’s own UI) or smaller than the browser’s minimum window is clamped, so the result is the geometry the session got, the same numbers Device.info reports from then on. The session pixel ratio does not change. The live-view frame changes size with the window: screenshots, Screen.observe and window-pixel coordinates use the new frame, and a live view pauses for 1 to 3 seconds while its stream restarts at the new size.
| Param | Type | Required | Description |
|---|---|---|---|
width | integer | Yes | The viewport width in CSS pixels. |
height | integer | Yes | The viewport height in CSS pixels. |
idempotencyKey | string | No | Makes a re-send after a reconnect safe: a repeated key returns the recorded response without acting again. See Idempotency keys. |