Skip to main content

setViewport

Resizes the browser viewport within the browser. As oppose to setWindowSize, this command changes the viewport size, not the window size.

Usage
browser.setViewport({ width, height, devicePixelRatio })
Parameters
NameTypeDetails
optionsSetViewportOptionscommand arguments
options.widthnumberviewport width in pixels
options.heightnumberviewport height in pixels
options.devicePixelRationumberpixel ratio of the viewport

Welcome! How can I help?

WebdriverIO AI Copilot