Viewport

class Viewport(val width: Int, val height: Int, val deviceScaleFactor: Float = 1.0f)

The size a session renders at.

A session created with a null viewport is one pixel: enough for text, the DOM and script, and far cheaper. Screenshots and layout-dependent pages need a real viewport, chosen when the session is created and fixed for its lifetime.

Constructors

Link copied to clipboard
constructor(width: Int, height: Int, deviceScaleFactor: Float = 1.0f)

Types

Link copied to clipboard
object Companion

Preset viewports for callers that do not want to pick their own dimensions.

Properties

Link copied to clipboard

Rendered pixels per CSS pixel, for crisper screenshots on high-density displays.

Link copied to clipboard
val height: Int

Height in CSS pixels.

Link copied to clipboard
val width: Int

Width in CSS pixels.