Window Size Issues When Running As a Scheduled Task In Windows Server (User Not Logged In)

I am currently launching my Katalon test suites via cmd line from Windows task scheduler. I have the task set to “Run whether user is logged on or not” due to the nature of my server environment. The tests run mostly without issue, however I noticed (from the failed tests’ screenshots) that the browser window was too small and causing tests to fail due to elements overlapping.

I have tried both the WebUI methods maximizeWindow() and setViewPortSize() but they do not set the browser beyond the native resolution. I have seen elsewhere that people were able to call selenium method “driver.manage().window().setSize(new Dimension(1920, 1080))” to get around this issue but I’m not sure how to adapt that for Katalon Studio.

Always having a user logged in to the server to perform these tests does not work for me, so I’m hoping there is a workaround to the resolution constraints. Any help would be much appreciated, thanks!

In Katalon Studio, you can use the same approach above, e.g:

import org.openqa.selenium.Dimension
import org.openqa.selenium.WebDriver
import com.kms.katalon.core.webui.driver.DriverFactory
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI
WebDriver driver = DriverFactory.getWebDriver()
driver.manage().window().setSize(new Dimension(1024,768));

Thanks for your answer. Unfortunately this did not solve my issue. Perhaps I am doing something wrong with my initial order of execution? After the below script I expect the resolution of the window to be 1920x1080, but the test fails due to element overlap that I can see from the screenshot in the report. The screenshot indicates the resolution is still around 1024x768. Any ideas?

import static com.kms.katalon.core.checkpoint.CheckpointFactory.findCheckpointimport static com.kms.katalon.core.testcase.TestCaseFactory.findTestCaseimport static com.kms.katalon.core.testdata.TestDataFactory.findTestDataimport static com.kms.katalon.core.testobject.ObjectRepository.findTestObjectimport com.kms.katalon.core.checkpoint.Checkpoint as Checkpointimport com.kms.katalon.core.checkpoint.CheckpointFactory as CheckpointFactoryimport as MobileBuiltInKeywordsimport as Mobileimport com.kms.katalon.core.model.FailureHandling as FailureHandlingimport com.kms.katalon.core.testcase.TestCase as TestCaseimport com.kms.katalon.core.testcase.TestCaseFactory as TestCaseFactoryimport com.kms.katalon.core.testdata.TestData as TestDataimport com.kms.katalon.core.testdata.TestDataFactory as TestDataFactoryimport com.kms.katalon.core.testobject.ObjectRepository as ObjectRepositoryimport com.kms.katalon.core.testobject.TestObject as TestObjectimport com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords as WSBuiltInKeywordsimport com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords as WSimport com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUiBuiltInKeywordsimport com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUIimport internal.GlobalVariable as GlobalVariableimport org.openqa.selenium.Dimensionimport org.openqa.selenium.WebDriverimport com.kms.katalon.core.webui.driver.DriverFactoryimport com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUIWebUI.openBrowser('')WebUI.delay(2)WebDriver driver = DriverFactory.getWebDriver()driver.manage().window().setSize(new Dimension(1920,1080));WebUI.maximizeWindow() // Have tried with and without maximizing after setSizeWebUI.navigateToUrl('http://private/url')
//Subsequent test steps....

Hi all,

I’m facing a similar issue : because of the small window size launched during the automated test, some of the screen elements can’t be found, which causes the test failure (although I’m using “start-maximized” flag).
Using selenium “driver.manage().window().setSize(new Dimension(1920, 1080))” didn’t help either.

Is there any workaround that works?

@lilys I had the same issue on my Jenkins / Linux server and using


Solved the problem.

1 Like

@manpreet.mukkar Unfortunately, it didn’t work in my case. My Jenkins job is running from the RDM and far as I understood it’s related to the way Jenkins allows remote connections, so I guess I have to change the size of the RDM window, but no success with that so far.