August 25, 2020, 3:34pm
I am experiencing an issue when running tests on docker.
I have set the headless execution settings in Katalon to a windows size of 1080x720 via the Project Settings → Desired Capabilities → Chrome(Headless).
However when I run these tests in docker the windows size is different. How Can I set the correct size in Docker please?
Warning: I don’t use docker at all or headless very often.
Try this code as a starter…
import org.openqa.selenium.WebDriver as WebDriver
import com.kms.katalon.core.webui.driver.DriverFactory as DriverFactory
WebDriver driver = DriverFactory.getWebDriver()
driver.manage().window().setPosition(new Point(x, y))
driver.manage().window().setSize(new Dimension(width, height))
August 25, 2020, 5:36pm
But it seems to be a setting with the docker container and xvfb that is missing to set the screensize of the container. Do you know anyone that could help?
August 26, 2020, 7:05am
this topic may help:
Yes. I tried but getting below error message -
java.awt.AWTError: Can’t connect to X11 window server using ‘:1’ as the value of the DISPLAY variable.
it is not enough just to set the browser windows size via capabilities or through the driver methods, but the virtual display size has to be set too, using xfvb-run. without specified size i think it will default to 800 x 600
however, xfvb is needed when using normal browser. with the headless one, the browser size can be set though the driver.
WebUI.SetViewPortSize should do the trick, it was a bug in 6.something but according to
@Zarashima the issue was fixed.
August 26, 2020, 1:44pm
Thank you all for the replies.
I now have the answer.
You need to add the environment variables to docker run in order to set the screen size.
docker run -e DISPLAY_CONFIGURATION=1080x1920x24
FYI i was trying:
docker run -e “DISPLAY_CONFIGURATION=1080x1920x24” but the quotes caused it to fail.
You both need to set Chrome viewport in Desired Capabilities settings and configure docker environment as well:
August 26, 2020, 5:57pm
Thank you, that’s of great help
I fixed this by using these environment variables.
I am using the docker image for selenium/node-chrome-debug