Appearance
UI.resize()
Resizes the browser window or viewport during test execution.
The viewport is the visible area of the page, excluing the browser chrome such as the address bar, tabs, and window border.
By default, UI.resize() resizes the entire browser window unless target: "viewport" is specified.
Usage
js
// Resize the browser window
UI.resize(resolution: string)
UI.resize(width: number, height: number)
// Pass { target: "viewport" } to resize the viewport
UI.resize(resolution: string, { target : "viewport" })
UI.resize(width: number, height: number, { target : "viewport" })Parameters
| Parameter | Type | Description |
|---|---|---|
resolution | string | Resolution in "<width>x<height>" format, e.g. 1920x1200. |
width | number | Width in pixels. |
height | number | Height in pixels. |
options.target | string | Set to "viewport" to resize the viewport. Set to "window" to resize the entire window (default). |
Example
js
UI.resize("764x600", {target: "viewport"})
I.see(".mobile-menu")In this example, the test resizes the browser viewport to a resolution of 764 × 600 pixels and verifies that the mobile menu is visible.