browser.viewport.set#
Functions#
height(height)
#
Attempt to set custom viewport height in pixels.
Note
It's recommended to run emulations in headless mode since an open browser may have minimum or maximum dimensions, either limited by the browser window or the monitor.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
height | int | Viewport height in pixels. | required |
size(width, height)
#
Attempt to set custom viewport size in pixels.
Note
It's recommended to run emulations in headless mode since an open browser may have minimum or maximum dimensions, either limited by the browser window or the monitor.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
width | int | Viewport width in pixels. | required |
height | int | Viewport height in pixels. | required |
size_by_device(device)
#
Attempt to set the viewport size by device types, e.g. iPhone, iPad, or other common devices.
Note
It's recommended to run emulations in headless mode since an open browser may have minimum or maximum dimensions, either limited by the browser window or the monitor.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
device | DeviceViewportSize | Device type to emulate. | required |
width(width)
#
Attempt to set custom viewport width in pixels.
Note
It's recommended to run emulations in headless mode since an open browser may have minimum or maximum dimensions, either limited by the browser window or the monitor.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
width | int | Viewport width in pixels. | required |