For AI agents: a documentation index is available at /llms.txt
Skip to main content

viewport

Sets the viewport dimensions for the browser session

**Usage Example:**

mutation SetViewport {
viewport(width: 1920, height: 1080) {
width
height
time
}
}

**Mobile device simulation:**

mutation MobileViewport {
viewport(width: 375, height: 667, deviceScaleFactor: 1, mobile: true) {
width
height
deviceScaleFactor
mobile
time
}
}

**Desktop simulation:**

mutation DesktopViewport {
viewport(width: 1920, height: 1080, mobile: false) {
width
height
mobile
time
}
}

**Field Definition:**

viewport(
width: Float!
height: Float!
deviceScaleFactor: Float = 1
mobile: Boolean = false
hasTouch: Boolean = false
landscape: Boolean = false
): ViewportResponse

Arguments

viewport.width ● Float! non-null scalar

The width of the viewport in pixels

viewport.height ● Float! non-null scalar

The height of the viewport in pixels

viewport.deviceScaleFactor ● Float scalar

The device scale factor, defaults to 1

viewport.mobile ● Boolean scalar

Whether to simulate a mobile device, defaults to false

viewport.hasTouch ● Boolean scalar

Whether the viewport supports touch events, defaults to false

viewport.landscape ● Boolean scalar

Whether the viewport is in landscape orientation, defaults to false. Only takes effect on a session with no active device-emulation profile. When a profile is active (for example, a stealth session emulating a specific device), the reported orientation is derived from that device's screen shape instead, and this argument has no effect on it.

Type

ViewportResponse object

Response returned after setting the viewport

Was this page helpful?