eyes set viewport size command

Platform: Selenium IDE

The viewport refers to the rectangular area within the browser or application window in which your application content is displayed. The viewport size can impact the layout of a page. For example, changing the width of the browser might change the way a paragraph of text is rendered. If the page is designed to be responsive, elements such as menus may be displayed in different ways, fonts size may change, and images may be scaled. Because of the potential impact of the viewport size on the layout, it is one of the 5 parameters that determine the baselineClosedDefines the sequence of images to which the sequence of images captured at checkpoints will be compared. A test can have multiple baselines, each of which is characterized by the execution environment it ran on (operating system, browser and viewport size). A baseline can have instances in multiple branches. that provides the reference images against which the captured checkpoint images are compared.

Eyes provides a command to set the viewport size. Setting the viewport has a dual impact. It causes the browser size to be adjusted to achieve the required viewport size, and it acts as one of the parameters that govern which baseline is used for the test.

Note that the notion viewport is platform specific, for example on desktop browsers the viewport does not include the browser status and toolbars, and on mobile devices, the user does not control the size of the browser window, and it typically includes the application decorations.

Usage

To set the viewport, use the SIDE Eyes command eyes set viewport size

This command takes a single parameter which is specified in the form widthxheight. For example, a value of 1024x768 means a width of 1024 pixels and a height of 768 pixels. Be careful when setting the viewport size that it is not too large. If after adding the browser margins and toolbars the browser is larger than the screen, then your test will fail with an error message.

Call this command after the Selenium IDE open command that opens the browser at the first URL and before the first eyes check call.

If you create the Selenium IDE script using the recording mechanism, then the recording will automatically generate a call to eyes set viewport size. The viewport size set will be the viewport size of the browser in which you ran the recording., If you want a different size, then you can change the viewport size in the script after the recording has finished.

If this command is not called, the viewport explicitly, then the browser opens a window with a platform-dependent size, and the viewport, and hence the baseline, is an outcome of that. For consistency over time, it is recommended that you always specify the viewport size explicitly.

Set viewport size when using Ultrafast Grid

When using Ultrafast Grid, you configure its options for one or more viewport sizes (see browser and viewport options, and device and orientation selection.). The test script should also include the eyes set viewport size command, this impacts the viewport size of the local browser running the script. For more details see Understanding how the viewport size is used