Resize browser greater than 1024x768 in console session

We run all our tests on Azure DevOps remote agents in console mode. This has been great for the past couple of years but now I’m running into a problem where I need my browser (usually Chrome) to be bigger than 1024x768. From a DevOps side I tried adding a screen resolution task to my pipeline, but this returns the error “The current user session is not a console session. It may not be possible to change the screen resolution.” and indeed WebUI.takeScreenshot produces the same 1024x768 image.

I then tried WebUI.setViewPortSize( 1920, 1080 ) in my code, but this didn’t seem to make any difference either.

I saw in this forum that you can change the project settings and add an argument “window-size=1920,1080” which I’ve not tried, but because project settings can be different from one user to another, the settings folder is not committed to the DevOps repository, so I’d rather find a scripting solution if there is one.

I hope this makes sense, it’s difficult to explain, but hopefully it will spark a useful conversation at least so I can find a solution! Thanks in advance.

Perfect sense. Unfortunately, I don’t have answer. @bionel have you tinkered with screen/viewport sizes in your pipeline(s)?

no sense for me with the data provided.
on what environment the tests are running?

windows, linux or docker on linux?

what kind of katalon profile is set, e. g Chrome or Chrome headless?

details matters, and solutions are different from case to case.

AzureDevops tells me nothing.
Is just yet another CI.

Important is, on what kind of node the job is running and what is actually running

Hi Bionel, I was afraid to go into too much detail and make it any more confusing than it had to be, but in answer to your questions…

on what environment the tests are running?
Windows 10 (on physical hardware)

what kind of katalon profile is set, e. g Chrome or Chrome headless?
Currently running on Chrome

AzureDevops tells me nothing
I mentioned it so that you know how the tests are being run - not in an RDP session for example, but using Azure DevOps self-hosted agents, in console mode
ADO Agents

what kind of node the job is running
No sure what you’re asking here?

what is actually running
A WebUI test of a simple website in Chrome. The reason this turned out to be a problem is because there is a button the test needs to click on, which is almost completely off-screen because of the small screen size. WebUI.verifyElementPresent says the button (//div[text()=“Resolved”]) is there, and WebUI.verifyElementClickable returns true too, but if I use WebUI.click on the object it fails (Unable to click on object ‘Object Repository/WellServUI/Page_CallManagement/div_Resolved’).
I’m sure I’ll run into similar issues moving forward because I need a browser size greater than what I can get in 1024x768, hence my question.

Thanks,
Graham

this is where we need more detail.
I assume the agent is a headless linux machine.
Is that corect?

How do you run the tests?
With installed KRE on the node or with the docker image?
What is the actual command you are using?

Mostly, you have to tune the xvfb settings first, but the solution is different for each case, to control the size of the virtual display.
After that, you can play with the size of the browser vieport, but the display size have to be solved first.
provided the virtual display size is right, maximize should work just fine, no need to specify a custom viewport / windows size

setting the viewport size make sense only when using the headless browser, since ther is no active window (therefore maximize wont work), but i strongly advise against using the headless browser for functional tests

I assume the agent is a headless linux machine.
No, these are self-hosted, physical Windows machines. No Docker, no VM/VDI, no Linux and not headless as far as I’m aware, although the Azure DevOps agent software is being run in “console mode”, which I don’t completely understand, perhaps this is a similar context to what you’ve described with xvfb, I can’t say for certain.

How do you run the tests?
With installed KRE. Still not sure what you mean by a node. The command being run is as follows…

cmd /c "C:\Users\svcd_WDTestFactory\.katalon\8.3.0\Katalon_Studio_Engine_Windows_64-8.3.0\katalonc.exe -noSplash -runMode=console -projectPath="c:\agent\_work\30\s\kp_WellServ.prj" -retry=0 -testSuitePath="Test Suites/WellServSuite" -executionProfile="Profile_DEV" -browserType="Chrome" -apiKey="xxx" --config -proxy.auth.option=NO_PROXY -proxy.system.option=NO_PROXY -proxy.system.applyToDesiredCapabilities=true -webui.autoUpdateDrivers=true"" in C:\Users\SVCD_W~1\AppData\Local\Temp\tmp-7092JYOoNWYBfNSz.

Thanks,
Graham

i cannot help you further on this, due to inconsistencies.

some terms you mention are conflicting with my experience.

e. g by ‘self hosting’ for my understanding will be a node i control and i know the details about such.

in your understanding i have no idea what it means.

i am not in mood and a don’t have the bandwith to create an ADO account for this and i dont have access to your internal infrastructure to dig on the hardware used.

I aleready provided the needed hints, feel free to digest what i wrote and adapt.

with windows nodes / agents and whatever may be named as executors for a certain CI, i have zero experience, and i will never use such

Hi bionel, no worries if you don’t have bandwidth to help further, I completely understand. Hopefully the details here might inspire another user already using ADO agents to chime in further.
I read back through my comments above and don’t see any inconsistencies though. The reason I included the “ADO Agents” link above is because it helps explain what is meant by a self-hosted agent in ADO terms. Quite simply it means that rather than using a virtual machine created by Azure DevOps, I have several physical machines, each running the ADO “Agent” software, which will allow remotely triggered pipelines (in my case, test automation). In short, a pool of physical Windows machines that we can queue/run our tests on.
The part I don’t fully understand (which is probably more of an ADO question than a Katalon question, I’m not sure) is how to change the size of a display when it’s in console mode, which (in my DOS-like brain!) makes little sense of how it can be running a browser ‘window’. Maybe in console mode this automatically runs in a headless browser even though I’ve not specified this, but then if that was the case, why wouldn’t setViewPortSize work? So confusing to me!

Yeah, I got that now.
But I have no idea how the mentioned ‘console mode’ works in the case of a windows machine.
(and this is what confused me, I was wrongly assume you are speaking about a linux machine)
I am way behind with windows usage, particularily as CI executors (nodes, agents whatever they may be named)
Even on my job workstation, I opted for an unconfigured machine and wipped windows from it.
I found my path in linux.

When running on a linux host, on a headless machine (without xserver and any DE installed), you can control the display size through xvfb (which is a must for running with normal browser on such platforms)

Perhaps you can try to run your tests with Docker, as far as I know this should work on windows also.

Katalon Docker image uses xvfb and you can control the display size by passing the needed environment variables when starting the container, see:

Alternate, use Chrome headless, altough I dislike the idea. The viewport control should work just fine in this case, since the headless mode it is not aware of a phisical or virtual display, it emulates his own in memory driver.

Or … use linux hosts …

Interesting, thanks bionel. I’ll look into the concept of doing this in Docker, and at worst have the tests run through a headless browser instead.