From 805691c417b4c5f2b816153b3988a6be801838e4 Mon Sep 17 00:00:00 2001 From: Joshua Letcher Date: Thu, 4 Jul 2019 22:00:24 -0400 Subject: [PATCH 1/3] Add SCREEN_DPI environment variable to configure screen resolution --- NodeBase/Dockerfile | 1 + NodeBase/Dockerfile.txt | 1 + NodeBase/start-xvfb.sh | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/NodeBase/Dockerfile b/NodeBase/Dockerfile index e5daff1e44..13c122dd18 100644 --- a/NodeBase/Dockerfile +++ b/NodeBase/Dockerfile @@ -95,6 +95,7 @@ COPY selenium.conf /etc/supervisor/conf.d/ ENV SCREEN_WIDTH 1360 ENV SCREEN_HEIGHT 1020 ENV SCREEN_DEPTH 24 +ENV SCREEN_DPI 96 ENV DISPLAY :99.0 ENV START_XVFB true diff --git a/NodeBase/Dockerfile.txt b/NodeBase/Dockerfile.txt index f4f7763747..48b5efa058 100644 --- a/NodeBase/Dockerfile.txt +++ b/NodeBase/Dockerfile.txt @@ -88,6 +88,7 @@ COPY selenium.conf /etc/supervisor/conf.d/ ENV SCREEN_WIDTH 1360 ENV SCREEN_HEIGHT 1020 ENV SCREEN_DEPTH 24 +ENV SCREEN_DPI 96 ENV DISPLAY :99.0 ENV START_XVFB true diff --git a/NodeBase/start-xvfb.sh b/NodeBase/start-xvfb.sh index ed0fe9ef6d..4d2ed0f2ce 100755 --- a/NodeBase/start-xvfb.sh +++ b/NodeBase/start-xvfb.sh @@ -5,7 +5,7 @@ if [ "${START_XVFB}" = true ] ; then rm -f /tmp/.X*lock - /usr/bin/Xvfb ${DISPLAY} -screen 0 ${GEOMETRY} -ac +extension RANDR + /usr/bin/Xvfb ${DISPLAY} -screen 0 ${GEOMETRY} -dpi ${SCREEN_DPI} -ac +extension RANDR else echo "Xvfb won't start. Chrome/Firefox can only run in headless mode. Remember to set the 'headless' flag in your test." fi From 0738ab7359c854e8b2d1f4d8d1f2e0d0c301f0b2 Mon Sep 17 00:00:00 2001 From: Joshua Letcher Date: Fri, 5 Jul 2019 00:38:26 -0400 Subject: [PATCH 2/3] Update README to mention the DPI environment variable --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 957e086cc5..30d11606e6 100644 --- a/README.md +++ b/README.md @@ -253,10 +253,10 @@ $ docker run -d -p :5555 -e HUB_HOST= -e HUB_PORT=44 ### Setting Screen Resolution -By default, nodes start with a screen resolution of 1360 x 1020 with a color depth of 24 bits. These settings can be adjusted by specifying `SCREEN_WIDTH`, `SCREEN_HEIGHT` and/or `SCREEN_DEPTH` environmental variables when starting the container. +By default, nodes start with a screen resolution of 1360 x 1020 with a color depth of 24 bits and a dpi of 96. These settings can be adjusted by specifying `SCREEN_WIDTH`, `SCREEN_HEIGHT`, `SCREEN_DEPTH`, and/or `SCREEN_DPI` environmental variables when starting the container. ``` bash -docker run -d -e SCREEN_WIDTH=1366 -e SCREEN_HEIGHT=768 -e SCREEN_DEPTH=24 selenium/standalone-firefox +docker run -d -e SCREEN_WIDTH=1366 -e SCREEN_HEIGHT=768 -e SCREEN_DEPTH=24 -e SCREEN_DPI=74 selenium/standalone-firefox ``` Bear in mind that in non-debug images, the maximize window command won't work. You can use the resize window command From 8d7aad47087487f6ee2798e81e4c7ea82ec5b593 Mon Sep 17 00:00:00 2001 From: Joshua Letcher Date: Mon, 8 Jul 2019 00:24:07 -0400 Subject: [PATCH 3/3] Reset dockerfile --- NodeBase/Dockerfile | 1 - 1 file changed, 1 deletion(-) diff --git a/NodeBase/Dockerfile b/NodeBase/Dockerfile index 13c122dd18..e5daff1e44 100644 --- a/NodeBase/Dockerfile +++ b/NodeBase/Dockerfile @@ -95,7 +95,6 @@ COPY selenium.conf /etc/supervisor/conf.d/ ENV SCREEN_WIDTH 1360 ENV SCREEN_HEIGHT 1020 ENV SCREEN_DEPTH 24 -ENV SCREEN_DPI 96 ENV DISPLAY :99.0 ENV START_XVFB true