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: browsers/viewport.mdx
+55-23Lines changed: 55 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,39 +3,57 @@ title: "Viewport Configuration"
3
3
description: "Configure browser viewport size and refresh rate for your automations"
4
4
---
5
5
6
-
Kernel browsers allow you to configure the viewport size and refresh rate when creating a browser session. The viewport configuration determines the initial browser window dimensions and display refresh rate.
6
+
Kernel browsers allow you to configure the viewport size and refresh rate when creating a browser session. The viewport configuration determines the initial browser window dimensions and display refresh rate. The refresh rate can be explicitly specified or automatically determined based on the width and height if they match a supported configuration.
7
7
8
8
## Setting viewport configuration
9
9
10
-
You can configure the viewport when creating a browser by specifying the `viewport` parameter with `width`, `height`, and`refresh_rate`:
10
+
You can configure the viewport when creating a browser by specifying the `viewport` parameter with `width` and `height`. The`refresh_rate` is optional and will be automatically determined from the dimensions if they match a supported configuration:
# Auto-determine refresh rate from dimensions (25Hz for 1920x1080)
44
+
kernel_browser_auto = client.browsers.create(
45
+
viewport={
46
+
"width": 1920,
47
+
"height": 1080
48
+
}
49
+
)
32
50
```
33
51
34
52
</CodeGroup>
35
53
36
54
## Supported viewport configurations
37
55
38
-
Kernel supports specific viewport configurations. The server will reject unsupported combinations. The following resolutions are supported:
56
+
Kernel supports specific viewport configurations. The server will reject unsupported combinations. When you provide width and height without specifying refresh_rate, it will be automatically determined if the dimensions match one of the supported resolutions exactly. The following resolutions are supported:
39
57
40
58
| Resolution | Width | Height | Refresh Rate |
41
59
|------------|-------|--------|--------------|
@@ -54,7 +72,7 @@ Higher resolutions may affect the responsiveness of [live view](/browsers/live-v
54
72
<CodeGroup>
55
73
56
74
```typescript Typescript/Javascript
57
-
// Full HD (1920x1080) at 25Hz
75
+
// Full HD (1920x1080) at 25Hz - explicit refresh rate
The viewport configuration has the following constraints:
155
-
-**Width**: Minimum 320px, Maximum 7680px
156
-
-**Height**: Minimum 240px, Maximum 4320px
157
-
-**Refresh Rate**: Must match the supported configurations listed above
187
+
-**Width** (required): Minimum 320px, Maximum 7680px
188
+
-**Height** (required): Minimum 240px, Maximum 4320px
189
+
-**Refresh Rate** (optional): If provided, must match the supported configurations listed above. If omitted, automatically determined from width and height.
158
190
159
191
<Note>
160
-
While the API accepts width and height values within the min/max ranges, only the specific resolution and refresh rate combinations listed in the supported configurations table are actually supported. The server will reject any unsupported combinations.
192
+
While the API accepts width and height values within the min/max ranges, only the specific resolution and refresh rate combinations listed in the supported configurations table are actually supported. When refresh_rate is omitted, it will be automatically determined if the width and height match a supported configuration exactly. The server will reject any unsupported combinations.
0 commit comments