diff --git a/Hub/start-selenium-hub.sh b/Hub/start-selenium-hub.sh index 856d3023d9..fe8cf87060 100755 --- a/Hub/start-selenium-hub.sh +++ b/Hub/start-selenium-hub.sh @@ -15,7 +15,7 @@ if [ ! -z "$SE_OPTS" ]; then echo "Appending Selenium options: ${SE_OPTS}" fi -java ${JAVA_OPTS} -jar /opt/selenium/selenium-server-standalone.jar \ +java ${JAVA_OPTS} -cp ${JAVA_CLASSPATH:-"/opt/selenium/*:."} org.openqa.grid.selenium.GridLauncherV3 \ -role hub \ -hubConfig ${CONF} \ ${SE_OPTS} diff --git a/NodeBase/start-selenium-node.sh b/NodeBase/start-selenium-node.sh index 21e96fa6fb..d843a6df54 100755 --- a/NodeBase/start-selenium-node.sh +++ b/NodeBase/start-selenium-node.sh @@ -36,10 +36,9 @@ fi rm -f /tmp/.X*lock -java ${JAVA_OPTS} -jar /opt/selenium/selenium-server-standalone.jar \ +java ${JAVA_OPTS} -cp ${JAVA_CLASSPATH:-"/opt/selenium/*:."} org.openqa.grid.selenium.GridLauncherV3 \ -role node \ -hub http://$HUB_PORT_4444_TCP_ADDR:$HUB_PORT_4444_TCP_PORT/grid/register \ ${REMOTE_HOST_PARAM} \ -nodeConfig /opt/selenium/config.json \ ${SE_OPTS} - diff --git a/README.md b/README.md index 4e1164c32d..957e086cc5 100644 --- a/README.md +++ b/README.md @@ -223,6 +223,14 @@ You can pass `SE_OPTS` variable with additional commandline parameters for start $ docker run -d -p 4444:4444 -e SE_OPTS="-debug" --name selenium-hub selenium/hub:3.141.59-radium ``` +### JAVA_CLASSPATH Java classpath + +By default, `CLASSPATH` for Java is `/opt/selenium/*:.` but you can overwrite it with yours using `JAVA_CLASSPATH`. This is useful when you want to use your own JAR files. Note that `/opt/selenium/*` always needs to be included because the Selenium JAR file is in the directory. + +```bash +$ docker run -d -p 4444:4444 -v $(pwd):/mnt -e JAVA_CLASSPATH="/mnt/*:/opt/selenium/*:." -e SE_OPTS="-servlets com.example.your.AwesomeServlet" --name selenium-hub selenium/hub:3.141.59-radium +``` + ### Selenium Hub and Node Configuration options For special network configurations or when the hub and the nodes are running on different machines `HUB_HOST` and `HUB_PORT` @@ -285,7 +293,7 @@ To avoid starting the server you can set the `START_XVFB` environment variable t ``` bash $ docker run -d --net grid -e HUB_HOST=selenium-hub -e START_XVFB=false -v /dev/shm:/dev/shm selenium/node-chrome -``` +``` For more information, see this Github [issue](https://github.com/SeleniumHQ/docker-selenium/issues/567). diff --git a/Standalone/start-selenium-standalone.sh b/Standalone/start-selenium-standalone.sh index 11536f0081..facb22cdb6 100755 --- a/Standalone/start-selenium-standalone.sh +++ b/Standalone/start-selenium-standalone.sh @@ -2,5 +2,5 @@ # # IMPORTANT: Change this file only in directory Standalone! -java ${JAVA_OPTS} -jar /opt/selenium/selenium-server-standalone.jar \ +java ${JAVA_OPTS} -cp ${JAVA_CLASSPATH:-"/opt/selenium/*:."} org.openqa.grid.selenium.GridLauncherV3 \ ${SE_OPTS}