Skip to content

Allow adding custom external jars to classpath #2726

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Apr 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions Distributor/start-selenium-grid-distributor.sh
Original file line number Diff line number Diff line change
Expand Up @@ -150,13 +150,18 @@ if [ ! -z "$SE_NEW_SESSION_THREAD_POOL_SIZE" ]; then
fi

EXTRA_LIBS=""
if [ -n "${SE_EXTRA_LIBS}" ]; then
EXTRA_LIBS="--ext ${SE_EXTRA_LIBS}"
fi

if [ "${SE_ENABLE_TRACING}" = "true" ] && [ -n "${SE_OTEL_EXPORTER_ENDPOINT}" ]; then
EXTERNAL_JARS=$(</external_jars/.classpath.txt)
[ -n "$EXTRA_LIBS" ] && [ -n "${EXTERNAL_JARS}" ] && EXTRA_LIBS=${EXTRA_LIBS}:
EXTRA_LIBS="--ext "${EXTRA_LIBS}${EXTERNAL_JARS}
if [ -n "${EXTRA_LIBS}" ] && [ -n "${EXTERNAL_JARS}" ]; then
EXTRA_LIBS="${EXTRA_LIBS}:${EXTERNAL_JARS}"
elif [ -z "${EXTRA_LIBS}" ] && [ -n "${EXTERNAL_JARS}" ]; then
EXTRA_LIBS="--ext ${EXTERNAL_JARS}"
fi
echo "Tracing is enabled"
echo "Classpath will be enriched with these external jars : " ${EXTRA_LIBS}
if [ -n "$SE_OTEL_SERVICE_NAME" ]; then
SE_OTEL_JVM_ARGS="$SE_OTEL_JVM_ARGS -Dotel.resource.attributes=service.name=${SE_OTEL_SERVICE_NAME}"
fi
Expand All @@ -178,6 +183,10 @@ else
echo "Tracing is disabled"
fi

if [ -n "${EXTRA_LIBS}" ]; then
echo "Classpath will be enriched with these external jars : ${EXTRA_LIBS}"
fi

if [ -n "${SE_JAVA_HTTPCLIENT_VERSION}" ]; then
SE_JAVA_OPTS="$SE_JAVA_OPTS -Dwebdriver.httpclient.version=${SE_JAVA_HTTPCLIENT_VERSION}"
fi
Expand Down
1 change: 1 addition & 0 deletions ENV_VARIABLES.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,3 +144,4 @@
| SE_NODE_REGISTER_SHUTDOWN_ON_FAILURE | true | If this flag is enabled, the Node will shut down after the register period is completed. This is useful for container environments to restart and register again. If restarted multiple times, the Node container status will be CrashLoopBackOff | --register-shutdown-on-failure |
| SE_NODE_RELAY_BROWSER_VERSION | | | |
| SE_NODE_RELAY_ONLY | true | | |
| SE_EXTRA_LIBS | | Extra jars to add to the classpath | --ext |
15 changes: 12 additions & 3 deletions EventBus/start-selenium-grid-eventbus.sh
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,18 @@ if [ "${SE_ENABLE_TLS}" = "true" ]; then
fi

EXTRA_LIBS=""
if [ -n "${SE_EXTRA_LIBS}" ]; then
EXTRA_LIBS="--ext ${SE_EXTRA_LIBS}"
fi

if [ "${SE_ENABLE_TRACING}" = "true" ] && [ -n "${SE_OTEL_EXPORTER_ENDPOINT}" ]; then
EXTERNAL_JARS=$(</external_jars/.classpath.txt)
[ -n "$EXTRA_LIBS" ] && [ -n "${EXTERNAL_JARS}" ] && EXTRA_LIBS=${EXTRA_LIBS}:
EXTRA_LIBS="--ext "${EXTRA_LIBS}${EXTERNAL_JARS}
if [ -n "${EXTRA_LIBS}" ] && [ -n "${EXTERNAL_JARS}" ]; then
EXTRA_LIBS="${EXTRA_LIBS}:${EXTERNAL_JARS}"
elif [ -z "${EXTRA_LIBS}" ] && [ -n "${EXTERNAL_JARS}" ]; then
EXTRA_LIBS="--ext ${EXTERNAL_JARS}"
fi
echo "Tracing is enabled"
echo "Classpath will be enriched with these external jars : " ${EXTRA_LIBS}
if [ -n "$SE_OTEL_SERVICE_NAME" ]; then
SE_OTEL_JVM_ARGS="$SE_OTEL_JVM_ARGS -Dotel.resource.attributes=service.name=${SE_OTEL_SERVICE_NAME}"
fi
Expand All @@ -108,6 +113,10 @@ else
echo "Tracing is disabled"
fi

if [ -n "${EXTRA_LIBS}" ]; then
echo "Classpath will be enriched with these external jars : ${EXTRA_LIBS}"
fi

if [ -n "${SE_JAVA_HTTPCLIENT_VERSION}" ]; then
SE_JAVA_OPTS="$SE_JAVA_OPTS -Dwebdriver.httpclient.version=${SE_JAVA_HTTPCLIENT_VERSION}"
fi
Expand Down
15 changes: 12 additions & 3 deletions Hub/start-selenium-grid-hub.sh
Original file line number Diff line number Diff line change
Expand Up @@ -130,13 +130,18 @@ if [ ! -z "${CONFIG_FILE}" ]; then
fi

EXTRA_LIBS=""
if [ -n "${SE_EXTRA_LIBS}" ]; then
EXTRA_LIBS="--ext ${SE_EXTRA_LIBS}"
fi

if [ "${SE_ENABLE_TRACING}" = "true" ] && [ -n "${SE_OTEL_EXPORTER_ENDPOINT}" ]; then
EXTERNAL_JARS=$(</external_jars/.classpath.txt)
[ -n "$EXTRA_LIBS" ] && [ -n "${EXTERNAL_JARS}" ] && EXTRA_LIBS=${EXTRA_LIBS}:
EXTRA_LIBS="--ext "${EXTRA_LIBS}${EXTERNAL_JARS}
if [ -n "${EXTRA_LIBS}" ] && [ -n "${EXTERNAL_JARS}" ]; then
EXTRA_LIBS="${EXTRA_LIBS}:${EXTERNAL_JARS}"
elif [ -z "${EXTRA_LIBS}" ] && [ -n "${EXTERNAL_JARS}" ]; then
EXTRA_LIBS="--ext ${EXTERNAL_JARS}"
fi
echo "Tracing is enabled"
echo "Classpath will be enriched with these external jars : " ${EXTRA_LIBS}
if [ -n "$SE_OTEL_SERVICE_NAME" ]; then
SE_OTEL_JVM_ARGS="$SE_OTEL_JVM_ARGS -Dotel.resource.attributes=service.name=${SE_OTEL_SERVICE_NAME}"
fi
Expand All @@ -158,6 +163,10 @@ else
echo "Tracing is disabled"
fi

if [ -n "${EXTRA_LIBS}" ]; then
echo "Classpath will be enriched with these external jars : ${EXTRA_LIBS}"
fi

if [ -n "${SE_JAVA_HTTPCLIENT_VERSION}" ]; then
SE_JAVA_OPTS="$SE_JAVA_OPTS -Dwebdriver.httpclient.version=${SE_JAVA_HTTPCLIENT_VERSION}"
fi
Expand Down
15 changes: 12 additions & 3 deletions NodeBase/start-selenium-node.sh
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,18 @@ if [ "$GENERATE_CONFIG" = true ]; then
fi

EXTRA_LIBS=""
if [ -n "${SE_EXTRA_LIBS}" ]; then
EXTRA_LIBS="--ext ${SE_EXTRA_LIBS}"
fi

if [ "${SE_ENABLE_TRACING}" = "true" ] && [ -n "${SE_OTEL_EXPORTER_ENDPOINT}" ]; then
EXTERNAL_JARS=$(</external_jars/.classpath.txt)
[ -n "$EXTRA_LIBS" ] && [ -n "${EXTERNAL_JARS}" ] && EXTRA_LIBS=${EXTRA_LIBS}:
EXTRA_LIBS="--ext "${EXTRA_LIBS}${EXTERNAL_JARS}
if [ -n "${EXTRA_LIBS}" ] && [ -n "${EXTERNAL_JARS}" ]; then
EXTRA_LIBS="${EXTRA_LIBS}:${EXTERNAL_JARS}"
elif [ -z "${EXTRA_LIBS}" ] && [ -n "${EXTERNAL_JARS}" ]; then
EXTRA_LIBS="--ext ${EXTERNAL_JARS}"
fi
echo "Tracing is enabled"
echo "Classpath will be enriched with these external jars : " ${EXTRA_LIBS}
if [ -n "$SE_OTEL_SERVICE_NAME" ]; then
SE_OTEL_JVM_ARGS="$SE_OTEL_JVM_ARGS -Dotel.resource.attributes=service.name=${SE_OTEL_SERVICE_NAME}"
fi
Expand All @@ -157,6 +162,10 @@ else
echo "Tracing is disabled"
fi

if [ -n "${EXTRA_LIBS}" ]; then
echo "Classpath will be enriched with these external jars : ${EXTRA_LIBS}"
fi

if [ ! -z "${SE_BIND_HOST}" ]; then
append_se_opts "--bind-host" "${SE_BIND_HOST}"
fi
Expand Down
15 changes: 12 additions & 3 deletions NodeDocker/start-selenium-grid-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,18 @@ echo "Selenium Grid Node Docker configuration: "
cat "${CONFIG_FILE}"

EXTRA_LIBS=""
if [ -n "${SE_EXTRA_LIBS}" ]; then
EXTRA_LIBS="--ext ${SE_EXTRA_LIBS}"
fi

if [ "${SE_ENABLE_TRACING}" = "true" ] && [ -n "${SE_OTEL_EXPORTER_ENDPOINT}" ]; then
EXTERNAL_JARS=$(</external_jars/.classpath.txt)
[ -n "$EXTRA_LIBS" ] && [ -n "${EXTERNAL_JARS}" ] && EXTRA_LIBS=${EXTRA_LIBS}:
EXTRA_LIBS="--ext "${EXTRA_LIBS}${EXTERNAL_JARS}
if [ -n "${EXTRA_LIBS}" ] && [ -n "${EXTERNAL_JARS}" ]; then
EXTRA_LIBS="${EXTRA_LIBS}:${EXTERNAL_JARS}"
elif [ -z "${EXTRA_LIBS}" ] && [ -n "${EXTERNAL_JARS}" ]; then
EXTRA_LIBS="--ext ${EXTERNAL_JARS}"
fi
echo "Tracing is enabled"
echo "Classpath will be enriched with these external jars : " ${EXTRA_LIBS}
if [ -n "$SE_OTEL_SERVICE_NAME" ]; then
SE_OTEL_JVM_ARGS="$SE_OTEL_JVM_ARGS -Dotel.resource.attributes=service.name=${SE_OTEL_SERVICE_NAME}"
fi
Expand All @@ -125,6 +130,10 @@ else
echo "Tracing is disabled"
fi

if [ -n "${EXTRA_LIBS}" ]; then
echo "Classpath will be enriched with these external jars : ${EXTRA_LIBS}"
fi

if [ -n "${SE_JAVA_HTTPCLIENT_VERSION}" ]; then
SE_JAVA_OPTS="$SE_JAVA_OPTS -Dwebdriver.httpclient.version=${SE_JAVA_HTTPCLIENT_VERSION}"
fi
Expand Down
15 changes: 12 additions & 3 deletions Router/start-selenium-grid-router.sh
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,18 @@ if [ ! -z "$SE_ROUTER_PASSWORD" ]; then
fi

EXTRA_LIBS=""
if [ -n "${SE_EXTRA_LIBS}" ]; then
EXTRA_LIBS="--ext ${SE_EXTRA_LIBS}"
fi

if [ "${SE_ENABLE_TRACING}" = "true" ] && [ -n "${SE_OTEL_EXPORTER_ENDPOINT}" ]; then
EXTERNAL_JARS=$(</external_jars/.classpath.txt)
[ -n "$EXTRA_LIBS" ] && [ -n "${EXTERNAL_JARS}" ] && EXTRA_LIBS=${EXTRA_LIBS}:
EXTRA_LIBS="--ext "${EXTRA_LIBS}${EXTERNAL_JARS}
if [ -n "${EXTRA_LIBS}" ] && [ -n "${EXTERNAL_JARS}" ]; then
EXTRA_LIBS="${EXTRA_LIBS}:${EXTERNAL_JARS}"
elif [ -z "${EXTRA_LIBS}" ] && [ -n "${EXTERNAL_JARS}" ]; then
EXTRA_LIBS="--ext ${EXTERNAL_JARS}"
fi
echo "Tracing is enabled"
echo "Classpath will be enriched with these external jars : " ${EXTRA_LIBS}
if [ -n "$SE_OTEL_SERVICE_NAME" ]; then
SE_OTEL_JVM_ARGS="$SE_OTEL_JVM_ARGS -Dotel.resource.attributes=service.name=${SE_OTEL_SERVICE_NAME}"
fi
Expand All @@ -159,6 +164,10 @@ else
echo "Tracing is disabled"
fi

if [ -n "${EXTRA_LIBS}" ]; then
echo "Classpath will be enriched with these external jars : ${EXTRA_LIBS}"
fi

if [ -n "${SE_JAVA_HTTPCLIENT_VERSION}" ]; then
SE_JAVA_OPTS="$SE_JAVA_OPTS -Dwebdriver.httpclient.version=${SE_JAVA_HTTPCLIENT_VERSION}"
fi
Expand Down
15 changes: 12 additions & 3 deletions SessionQueue/start-selenium-grid-session-queue.sh
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,18 @@ if [ ! -z "$SE_REGISTRATION_SECRET" ]; then
fi

EXTRA_LIBS=""
if [ -n "${SE_EXTRA_LIBS}" ]; then
EXTRA_LIBS="--ext ${SE_EXTRA_LIBS}"
fi

if [ "${SE_ENABLE_TRACING}" = "true" ] && [ -n "${SE_OTEL_EXPORTER_ENDPOINT}" ]; then
EXTERNAL_JARS=$(</external_jars/.classpath.txt)
[ -n "$EXTRA_LIBS" ] && [ -n "${EXTERNAL_JARS}" ] && EXTRA_LIBS=${EXTRA_LIBS}:
EXTRA_LIBS="--ext "${EXTRA_LIBS}${EXTERNAL_JARS}
if [ -n "${EXTRA_LIBS}" ] && [ -n "${EXTERNAL_JARS}" ]; then
EXTRA_LIBS="${EXTRA_LIBS}:${EXTERNAL_JARS}"
elif [ -z "${EXTRA_LIBS}" ] && [ -n "${EXTERNAL_JARS}" ]; then
EXTRA_LIBS="--ext ${EXTERNAL_JARS}"
fi
echo "Tracing is enabled"
echo "Classpath will be enriched with these external jars : " ${EXTRA_LIBS}
if [ -n "$SE_OTEL_SERVICE_NAME" ]; then
SE_OTEL_JVM_ARGS="$SE_OTEL_JVM_ARGS -Dotel.resource.attributes=service.name=${SE_OTEL_SERVICE_NAME}"
fi
Expand All @@ -112,6 +117,10 @@ else
echo "Tracing is disabled"
fi

if [ -n "${EXTRA_LIBS}" ]; then
echo "Classpath will be enriched with these external jars : ${EXTRA_LIBS}"
fi

if [ -n "${SE_JAVA_HTTPCLIENT_VERSION}" ]; then
SE_JAVA_OPTS="$SE_JAVA_OPTS -Dwebdriver.httpclient.version=${SE_JAVA_HTTPCLIENT_VERSION}"
fi
Expand Down
21 changes: 15 additions & 6 deletions Sessions/start-selenium-grid-sessions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,18 @@ if [ ! -z "${CONFIG_FILE}" ]; then
fi

EXTRA_LIBS=""
if [ -n "${SE_EXTRA_LIBS}" ]; then
EXTRA_LIBS="--ext ${SE_EXTRA_LIBS}"
fi

if [ "${SE_ENABLE_TRACING}" = "true" ] && [ -n "${SE_OTEL_EXPORTER_ENDPOINT}" ]; then
EXTERNAL_JARS=$(</external_jars/.classpath.txt)
[ -n "$EXTRA_LIBS" ] && [ -n "${EXTERNAL_JARS}" ] && EXTRA_LIBS=${EXTRA_LIBS}:
EXTRA_LIBS="${EXTRA_LIBS}${EXTERNAL_JARS}"
if [ -n "${EXTRA_LIBS}" ] && [ -n "${EXTERNAL_JARS}" ]; then
EXTRA_LIBS="${EXTRA_LIBS}:${EXTERNAL_JARS}"
elif [ -z "${EXTRA_LIBS}" ] && [ -n "${EXTERNAL_JARS}" ]; then
EXTRA_LIBS="--ext ${EXTERNAL_JARS}"
fi
echo "Tracing is enabled"
echo "Classpath will be enriched with these external jars : " ${EXTRA_LIBS}
if [ -n "$SE_OTEL_SERVICE_NAME" ]; then
SE_OTEL_JVM_ARGS="$SE_OTEL_JVM_ARGS -Dotel.resource.attributes=service.name=${SE_OTEL_SERVICE_NAME}"
fi
Expand All @@ -135,13 +140,17 @@ else
fi

if [ "${SE_SESSIONS_MAP_EXTERNAL_DATASTORE}" = "true" ]; then
echo "External datastore for sessions map is enabled"
EXTERNAL_JARS=$(</external_jars/.classpath_session_map.txt)
[ -n "$EXTRA_LIBS" ] && [ -n "${EXTERNAL_JARS}" ] && EXTRA_LIBS=${EXTRA_LIBS}:
EXTRA_LIBS="${EXTRA_LIBS}${EXTERNAL_JARS}"
if [ -n "${EXTRA_LIBS}" ] && [ -n "${EXTERNAL_JARS}" ]; then
EXTRA_LIBS="${EXTRA_LIBS}:${EXTERNAL_JARS}"
elif [ -z "${EXTRA_LIBS}" ] && [ -n "${EXTERNAL_JARS}" ]; then
EXTRA_LIBS="--ext ${EXTERNAL_JARS}"
fi
fi

if [ -n "${EXTRA_LIBS}" ]; then
EXTRA_LIBS="--ext ${EXTRA_LIBS}"
echo "Classpath will be enriched with these external jars : ${EXTRA_LIBS}"
fi

cat "$CONFIG_FILE"
Expand Down
15 changes: 12 additions & 3 deletions Standalone/start-selenium-standalone.sh
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,18 @@ cat "${CONFIG_FILE}"
echo "Starting Selenium Grid Standalone..."

EXTRA_LIBS=""
if [ -n "${SE_EXTRA_LIBS}" ]; then
EXTRA_LIBS="--ext ${SE_EXTRA_LIBS}"
fi

if [ "${SE_ENABLE_TRACING}" = "true" ] && [ -n "${SE_OTEL_EXPORTER_ENDPOINT}" ]; then
EXTERNAL_JARS=$(</external_jars/.classpath.txt)
[ -n "$EXTRA_LIBS" ] && [ -n "${EXTERNAL_JARS}" ] && EXTRA_LIBS=${EXTRA_LIBS}:
EXTRA_LIBS="--ext "${EXTRA_LIBS}${EXTERNAL_JARS}
if [ -n "${EXTRA_LIBS}" ] && [ -n "${EXTERNAL_JARS}" ]; then
EXTRA_LIBS="${EXTRA_LIBS}:${EXTERNAL_JARS}"
elif [ -z "${EXTRA_LIBS}" ] && [ -n "${EXTERNAL_JARS}" ]; then
EXTRA_LIBS="--ext ${EXTERNAL_JARS}"
fi
echo "Tracing is enabled"
echo "Classpath will be enriched with these external jars : " ${EXTRA_LIBS}
if [ -n "$SE_OTEL_SERVICE_NAME" ]; then
SE_OTEL_JVM_ARGS="$SE_OTEL_JVM_ARGS -Dotel.resource.attributes=service.name=${SE_OTEL_SERVICE_NAME}"
fi
Expand All @@ -157,6 +162,10 @@ else
echo "Tracing is disabled"
fi

if [ -n "${EXTRA_LIBS}" ]; then
echo "Classpath will be enriched with these external jars : ${EXTRA_LIBS}"
fi

CHROME_DRIVER_PATH_PROPERTY=-Dwebdriver.chrome.driver=/usr/bin/chromedriver
EDGE_DRIVER_PATH_PROPERTY=-Dwebdriver.edge.driver=/usr/bin/msedgedriver
GECKO_DRIVER_PATH_PROPERTY=-Dwebdriver.gecko.driver=/usr/bin/geckodriver
Expand Down
15 changes: 12 additions & 3 deletions StandaloneDocker/start-selenium-grid-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,18 @@ echo "Selenium Grid Standalone Docker configuration: "
cat "${CONFIG_FILE}"

EXTRA_LIBS=""
if [ -n "${SE_EXTRA_LIBS}" ]; then
EXTRA_LIBS="--ext ${SE_EXTRA_LIBS}"
fi

if [ "${SE_ENABLE_TRACING}" = "true" ] && [ -n "${SE_OTEL_EXPORTER_ENDPOINT}" ]; then
EXTERNAL_JARS=$(</external_jars/.classpath.txt)
[ -n "$EXTRA_LIBS" ] && [ -n "${EXTERNAL_JARS}" ] && EXTRA_LIBS=${EXTRA_LIBS}:
EXTRA_LIBS="--ext "${EXTRA_LIBS}${EXTERNAL_JARS}
if [ -n "${EXTRA_LIBS}" ] && [ -n "${EXTERNAL_JARS}" ]; then
EXTRA_LIBS="${EXTRA_LIBS}:${EXTERNAL_JARS}"
elif [ -z "${EXTRA_LIBS}" ] && [ -n "${EXTERNAL_JARS}" ]; then
EXTRA_LIBS="--ext ${EXTERNAL_JARS}"
fi
echo "Tracing is enabled"
echo "Classpath will be enriched with these external jars : " ${EXTRA_LIBS}
if [ -n "$SE_OTEL_SERVICE_NAME" ]; then
SE_OTEL_JVM_ARGS="$SE_OTEL_JVM_ARGS -Dotel.resource.attributes=service.name=${SE_OTEL_SERVICE_NAME}"
fi
Expand All @@ -130,6 +135,10 @@ else
echo "Tracing is disabled"
fi

if [ -n "${EXTRA_LIBS}" ]; then
echo "Classpath will be enriched with these external jars : ${EXTRA_LIBS}"
fi

if [ -n "${SE_JAVA_HTTPCLIENT_VERSION}" ]; then
SE_JAVA_OPTS="$SE_JAVA_OPTS -Dwebdriver.httpclient.version=${SE_JAVA_HTTPCLIENT_VERSION}"
fi
Expand Down
Loading