Set window size by utilizing Smart Test Recorder

To set the screen size during headless execution by utilizing the test recorder, you need to have the Web Extensions addon and look for Set windows size action.
You can find it here: https://addons.testproject.io/web-extensions.

After the first step of "Navigate to" action add a step of "Set window size"

Then, select the Set Window Size and supply the required size.

For example:


You can also use the Maximize Screen action if you wish it to run on full screen.

That's it, now you run your test in headless mode with the desired solution! 

Set window size with Coded Test

In your coded test you can easily change the window size by using the driver instance.

// We get the instance for the web driver
WebDriver driver = helper.getDriver();

// set the window to the dimension we want, for example 1440, 900
driver.manage().window().setSize(new Dimension(1440, 900));

// With this line we can set it to full screen
driver.manage().window().fullscreen();

Happy testing!

Did this answer your question?