Skip to content

Commit 0ae3675

Browse files
CaffeinatedCMdiemol
authored andcommitted
Add ability to configure screen DPI (#942)
* Add SCREEN_DPI environment variable to configure screen resolution * Update README to mention the DPI environment variable * Reset dockerfile
1 parent e99d571 commit 0ae3675

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

NodeBase/Dockerfile.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ COPY selenium.conf /etc/supervisor/conf.d/
8888
ENV SCREEN_WIDTH 1360
8989
ENV SCREEN_HEIGHT 1020
9090
ENV SCREEN_DEPTH 24
91+
ENV SCREEN_DPI 96
9192
ENV DISPLAY :99.0
9293
ENV START_XVFB true
9394

NodeBase/start-xvfb.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ if [ "${START_XVFB}" = true ] ; then
55

66
rm -f /tmp/.X*lock
77

8-
/usr/bin/Xvfb ${DISPLAY} -screen 0 ${GEOMETRY} -ac +extension RANDR
8+
/usr/bin/Xvfb ${DISPLAY} -screen 0 ${GEOMETRY} -dpi ${SCREEN_DPI} -ac +extension RANDR
99
else
1010
echo "Xvfb won't start. Chrome/Firefox can only run in headless mode. Remember to set the 'headless' flag in your test."
1111
fi

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,10 +253,10 @@ $ docker run -d -p <node_port>:5555 -e HUB_HOST=<hub_ip|hub_name> -e HUB_PORT=44
253253

254254
### Setting Screen Resolution
255255

256-
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.
256+
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.
257257

258258
``` bash
259-
docker run -d -e SCREEN_WIDTH=1366 -e SCREEN_HEIGHT=768 -e SCREEN_DEPTH=24 selenium/standalone-firefox
259+
docker run -d -e SCREEN_WIDTH=1366 -e SCREEN_HEIGHT=768 -e SCREEN_DEPTH=24 -e SCREEN_DPI=74 selenium/standalone-firefox
260260
```
261261

262262
Bear in mind that in non-debug images, the maximize window command won't work. You can use the resize window command

0 commit comments

Comments
 (0)