Maximize Chrome headless window

Hello there,

I’m trying to run a test case using Chrome headless.
In my script, there is a button that is visible only if the browser window is maximized (otherwise it’s hidden). I tried to add a capability for this (start-maximized, window-size) but it didn’t work. It could be that I did it the wrong way so if you know the right way of doing that please explain how.
By the way, using Firefox headless it’s working without adding any additional capabilities.
Any ideas?

Thanks,
Roi

Roi,

even not work with this capability “options.addArguments(”–window-size=1325x744");"?

1 Like

I add capabilities to Project>>Settings>>Execution>>Default>>WebUI>>Chrome(Headless)
I remember that I already tried this capability. The problem is that I’m not sure what is the right way to add each capability. Should I add it as a string in “args” list??

Trong Bui said:

Roi,

even not work with this capability “options.addArguments(”–window-size=1325x744");"?

[SOLVED]
I created an “args” list and added the string “–window-size=1325,744”.
Note that it didn’t work using ‘x’ between the dimensions, only with a comma.
Thanks

1 Like

could you pleas especifie how did you solve it ?
i am fasing the same problem

WebUI.openBrowser(’’)

WebUI.maximizeWindow()

WebUI.navigateToUrl(‘https://d-hubtra-app01.cpdev.local/mediahub/traffic/login’)

WebUI.acceptAlert()

Test Cases/Catalogue/Actions/Initialisation FAILED because (of) (Stack trace: com.kms.katalon.core.exception.StepFailedException: Unable to maximize current window (Root cause: org.openqa.selenium.WebDriverException: unknown error: failed to change window state to maximized, current state is normal
(Session info: chrome=69.0.3497.100)
1 Like

I’m having the same issue with Katalon 5.9.0 on Linux with Chrome (not headless). I need to maximize in the test. It works in the GUI but not on the command line, even with a window manager.

Is

options.addArguments("--window-size=1325x744");

something that’s done on the command line or within the test itself?

1 Like

Hi,

you can add options to browser properties file

in path

C:\KatalonStudio\\settings\internal\com.kms.katalon.core.webui.chrome.properties

or external if you have using custom browser

C:\KatalonStudio\\settings\external

like i have added few options

{“CHROME_DRIVER”:{“args”:["–disable-infobars", “–start-maximized”]}}

options listed here

https://peter.sh/experiments/chromium-command-line-switches/

Hi guys,

i’m still facing this issue only in chromeheadless (Version 83),
i’ve tried all solution in this thread and not work at all

is any way to solved it?
Thanks