Window does not get maximized in docker container

Hello,

Has anyone noticed that maximizeWindow() keyword does not work in docker container.
I have checked the screenshots after the tests run and it does not get maximized.

It does not throw any error but it does not work as well.

Thanks

One for @bionel I think…

@Russ_Thomas meah… I tend to say pass this time, since i dont have a bussiness licence to run dockerized katalon for proper debug…

However, lets try
@anuradha kindly bring more context.
For the begining, share your running command/pipeline file and we can try to guide you via ‘blinding debug’ methods. You have to be our eyes into this matter

Some info about the running environment may help too

Hi @bionel

My docker-compose.yml file is as below:

version: “3”
services:
katalon:
build: .
container_name: katalon
networks:
- x_network
environment:
base_URL: “www.google.com” [here is the url of the site]
volumes:
- .:/katalon/katalon/source
command: bash -c ‘apt-get install tree -y && rm /katalon/katalon/source/Include/drivers/chromedriver_linux64/chromedriver || true && mkdir -p /katalon/katalon/source/Include/drivers/chromedriver_linux64/ && unzip /tmp/chromedriver/chromedriver.zip chromedriver -d /katalon/katalon/source/Include/drivers/chromedriver_linux64/ && tree -L 3 /katalon/katalon/source/Include/ && xvfb-run --server-args="-screen 0, 1024x768x24" --auto-servernum --server-num=1 /opt/katalonstudio/katalonc -retry=0 -testSuitePath=“Test Suites/Generic_Test_Cases/App_Flow” -executionProfile=“xxx” -browserType=“Chrome” -apiKey=“xxx” -projectPath="/katalon/katalon/source/xxx.prj"’
networks:
x_network:
external: true

My Dockerfile content:
FROM katalonstudio/katalon:7.7.2
RUN locale
RUN apt-get update -y
RUN apt-get install -y locales
RUN echo “en_US UTF-8” > /etc/locale.gen
RUN locale-gen en_US.UTF-8
ENV LC_ALL en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US.UTF-8
RUN locale
RUN apt install iputils-ping -y

RUN apt-get install unzip && a=$(uname -m) && rm -r /tmp/chromedriver/ || true && mkdir /tmp/chromedriver/ -p &&
#wget -O /tmp/chromedriver/LATEST_RELEASE http://chromedriver.storage.googleapis.com/LATEST_RELEASE &&
#latest=$(cat /tmp/chromedriver/LATEST_RELEASE) &&
latest=85.0.4183.87 &&
wget -O /tmp/chromedriver/chromedriver.zip ‘http://chromedriver.storage.googleapis.com/’$latest’/chromedriver_linux64.zip
#RUN mkdir -p /katalon/katalon/source/Include/drivers/chromedriver_linux64/ && unzip /tmp/chromedriver/chromedriver.zip chromedriver -d /katalon/katalon/source/Include/drivers/chromedriver_linux64/

My openBrowser script:
site_URL=CustomKeywords.‘essentials.ApplicationContext.getPath’()
WebUI.openBrowser(site_URL)
WebUI.maximizeWindow()
System.out.println(site_URL)

I am using katalon 7.7.2 and linux.

If you need any other info please do let me know.

Thanks

@anuradha in addition to the above, plase share also a screenshhot grabbed.
Do not alter the image size.
If the screenshot contains sensitive data you can blur it/censore it but do not crop or rescale.
What i am trying to figure out for the moment is the sentence ‘browser does not maximize’
It is not maximized at the virtual view-port size or the screenshot you have is not at the expected size?

Thanks @bionel,

This is one of the screenshot:

If i understand correctly the size is 1024x768 as added for the xvfb screensize. The browser is not getting maximized from the WebUI.maximizeWindow keyword.

But even if i add setviewport size in my openbrowser script it does not maximize the window.
If i run it outside docker [from the ide] it shows a full screen as below:

the screenshot size seems to be 1837x941 … could be your physical display resolution (or close)?

after cropping to the browser area, i am close to 1024x768 (minus some bottom space perhaps?):

so … if you didn’t altered the pic size … i think it is working right, browser gets maximized to the frame-buffer size

try to increase the xvfb virtual display size.

Hi @bionel , but if i say maximize window , should not it maximize the window as per my xvfb resolution?
If we are not counting the black space outside the screenshot[this is coming in the screenshot generated after the tests run] - should not the screen be full screen like when i run the tests outside docker?

Thanks

yes and no
xvfb stands for X(server)VirtualFrameBuffer.
you are running your script with xvfb-run --server-args="-screen 0, 1024x768x24"
so, no matter what is the physical display size, when running via docker the maximum you can get is the framebuffer size (however the screenshot keyword may grab it to the display size, dunno why. i have no idea how the screenshot feature is working under the hood)

when you run it from the IDE maximum screen size is the physical display resolution (even with headless driver)

1 Like

Thanks @bionel,

Do you know if there is a command or something i can add in the docker command to maximize the screensize for the xvfb. I want the screen to have same size as in my physical display resolution as now whatever screensize i am trying some elements are getting hidden and i am getting element not interactable.

Like maximize the chrome in my docker.

already told you. is in the command line
did you read my post?

just for my curiosity, why are you doing this in the pipeline (compose file)?
this should be done at the image level via the Dockerfile (and seems like you already doing this) so having it also in the compose file command line is redundant.

this is a bad practice, each RUN line in the Dockerfile adds and extra layer therefore incresing the final image size. Better to collapse all this RUN’s into a single one.

And, in the end, why are you re-building your image each and every-time you run the compose?
You can simply build your custom image by a separate job and push it to DockerHub (or keep it just local if you like), and re-build it only when need it (chromedriver update, new katalon release etc)

Yeah … ok, docker will cache all this layers … but still, this makes your pipeline confusing and hard to maintain.