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
+47-1Lines changed: 47 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -135,6 +135,52 @@ func main() {
135
135
The `refresh_rate` parameter only applies to live view sessions and is ignored for [headless](/browsers/headless) browsers.
136
136
</Info>
137
137
138
+
## Window size vs. page viewport
139
+
140
+
The `viewport` parameter sets the dimensions of the browser **window**, not the visible page area. On headful browsers, Chromium's UI (tab strip and toolbar) occupies part of the window height, so the page renders in a slightly shorter area than the configured height. For example, with a 1280x800 viewport, `window.innerHeight` will be less than 800 and content near the bottom of the page may not be visible in screenshots or live view.
141
+
142
+
If your automation expects an exact page viewport, either:
143
+
144
+
-**Use kiosk mode** to remove the browser UI, so the window dimensions match the page viewport exactly:
-**Set the page viewport through your automation framework.** This will update the rendered page size, but will not be reflected in the live view or computer controls:
-**Account for the browser UI when choosing dimensions** by adding its height to the `height` you pass to Kernel, so the remaining page area matches your target size.
181
+
182
+
On [headless](/browsers/headless) browsers there is no browser UI, so the page viewport matches the configured dimensions exactly.
183
+
138
184
## Supported viewport configurations
139
185
140
186
Kernel supports specific viewport configurations tuned for optimal performance and Computer Use compatibility. 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:
@@ -414,4 +460,4 @@ if err != nil {
414
460
- The viewport configuration is set when the browser is created and applies to the initial browser window
415
461
- Higher resolutions (like 2560x1440) may impact the performance and responsiveness of live view sessions
416
462
- The viewport size affects how websites render, especially those with responsive designs
417
-
- Screenshots taken from the browser will match the configured viewportdimensions
463
+
- Screenshots taken through your automation framework capture the page viewport, which on headful browsers is shorter than the configured dimensions due to the browser UI (see [Window size vs. page viewport](#window-size-vs-page-viewport))
0 commit comments