In this article, we explain how to change the browser window size when executing a test. Changing the window size is useful in the following types of cases:
- In case you want to test a website at a specific recommended size
- If you want to stabilize results with periodic batch executions
- In particular, it is almost mandatory to use the visual diff confirmation command.
The browser window size can be changed from the test run settings dialog. When all of these are left blank, the default size of the machine running the browser will be used.
The "Maximize to match the screen size" checkbox is selected by default in the Cloud environment. In this case, the window size is set to 1360x1000px.
When left blank or set to "Maximize to match the screen size," the window size can vary depending on the machine.
Caution
Currently, the meaning of "window size" differs between Selenium and Playwright.
- With Selenium: the size of the entire window, including the top bar and window frame (the red box in the figure below).
- With Playwright: the area where the HTML is rendered (the blue box).
The size of the top bar and window frame may vary depending on the OS (Windows/Mac/Linux). Therefore, the HTML area size may differ across environments when using Selenium, even when you specify the same window size.