You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is how we go about building images with more than one browser.
Essentially it is just a combination of the different dockerfiles for the separate nodes.
I don't know much about how the tests is setup here, and could also not find a good place for documenting the new node-type. So I leave that to someone that is more involved in the "Selenium way" of doing stuff.
Motivation and Context
This PR is supposed to solve #2795 feature request. Basically this is one way of building a node, that holds more than one type of browser. The total size image is much smaller than building three separate browser nodes.
Types of changes
Bug fix (non-breaking change which fixes an issue)
New feature (non-breaking change which adds functionality)
Breaking change (fix or feature that would cause existing functionality to change)
All three cleanup configuration files (chrome, edge, firefox) use the same program name "browserleftoverscleanup" in supervisord config, which could cause conflicts when all are loaded.
This appears to be an exact duplicate of the wrap_chrome_binary file and should be removed to avoid confusion and maintenance issues.
#!/bin/bash
WRAPPER_PATH=$(readlink -f /usr/bin/google-chrome)
BASE_PATH="$WRAPPER_PATH-base"
mv "$WRAPPER_PATH" "$BASE_PATH"
cat >"$WRAPPER_PATH" <<_EOF
#!/bin/bash# umask 002 ensures default permissions of files are 664 (rw-rw-r--) and directories are 775 (rwxrwxr-x).
umask 002
# Debian/Ubuntu seems to not respect --lang, it instead needs to be a LANGUAGE environment var# See: https://stackoverflow.com/a/41893197/359999
for var in "\$@"; do
if [[ \$var == --lang=* ]]; then
LANGUAGE=\${var//--lang=}
fi
done
# Set language environment variable
export LANGUAGE="\$LANGUAGE"
# Capture the filtered environment variables start with "SE_BROWSER_ARGS_" into an array
mapfile -t BROWSER_ARGS_ARRAY < <(printenv | grep ^SE_BROWSER_ARGS_)
# Iterate over the array
for var in "\${BROWSER_ARGS_ARRAY[@]}"; do
# Split the variable into name and value
IFS='=' read -r name value <<< "\$var"
SE_BROWSER_ARGS="\$SE_BROWSER_ARGS \$value"
done
# Note: exec -a below is a bashism.
exec -a "\$0" "$BASE_PATH" --no-sandbox \$SE_BROWSER_ARGS "\$@"
_EOF
chmod +x "$WRAPPER_PATH"
The browser configuration at the end of the Dockerfile overwrites previous browser entries since it uses the same files repeatedly, potentially leaving only Firefox configuration accessible.
RUN echo "chrome" > /opt/selenium/browser_name
RUN google-chrome --version | awk '{print $3}' | cut -d'.' -f1,2 >> /opt/selenium/browser_version
RUN echo "\"goog:chromeOptions\": {\"binary\": \"/usr/bin/google-chrome\"}" >> /opt/selenium/browser_binary_location
RUN echo "MicrosoftEdge" > /opt/selenium/browser_name
RUN microsoft-edge --version | awk '{print $3}' | cut -d'.' -f1,2 >> /opt/selenium/browser_version
RUN echo "\"ms:edgeOptions\": {\"binary\": \"/usr/bin/microsoft-edge\"}" >> /opt/selenium/browser_binary_location
RUN echo "firefox" > /opt/selenium/browser_name
RUN firefox --version | awk '{print $3}' >> /opt/selenium/browser_version
RUN echo "\"moz:firefoxOptions\": {\"binary\": \"/usr/bin/firefox\"}" >> /opt/selenium/browser_binary_location
✅ Use unique program namesSuggestion Impact:The commit renamed the program from 'browserleftoverscleanup' to 'chromeleftoverscleanup' to make it unique, and also updated the log file names to be browser-specific. This addresses the core issue identified in the suggestion.
The program name should be unique across all supervisord configuration files. Since there are three identical program names (browserleftoverscleanup) in different conf files, this will cause conflicts when supervisord loads them.
Why: The suggestion correctly identifies that using the same program name browserleftoverscleanup in multiple supervisord configuration files (chrome-cleanup.conf, edge-cleanup.conf, firefox-cleanup.conf) will cause conflicts, likely preventing some cleanup tasks from running. This is a significant correctness issue.
Hi, thank you for your work and contribution to this area. However, I am still thinking about the approach to build multiple layers to reduce the duplicated code (cloned Dockerfile and scripts). So, I will keep your PR here for a while before making a decision to use this or not.
Absolutely! Feel free to do whatever suits the project best.
It might be a good idea to import only parts from the other builds if at all possible..
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
User description
Description
This is how we go about building images with more than one browser.
Essentially it is just a combination of the different dockerfiles for the separate nodes.
I don't know much about how the tests is setup here, and could also not find a good place for documenting the new node-type. So I leave that to someone that is more involved in the "Selenium way" of doing stuff.
Motivation and Context
This PR is supposed to solve #2795 feature request. Basically this is one way of building a node, that holds more than one type of browser. The total size image is much smaller than building three separate browser nodes.
Types of changes
Checklist
PR Type
Enhancement
Description
Introduce multi-browser Selenium node Dockerfile
Add browser cleanup scripts and supervisor configs
Implement browser binary wrappers for Chrome and Edge
Provide utility scripts for Firefox installation and language packs
Changes walkthrough 📝
9 files
Add Dockerfile for multi-browser Selenium node imageAdd Chrome process and temp file cleanup scriptAdd Edge process and temp file cleanup scriptAdd Firefox process cleanup scriptAdd script to download Firefox language packsAdd script to set up Firefox APT repositoryAdd script for Firefox package installation logicAdd Chrome binary wrapper for argument handlingAdd Edge binary wrapper for argument handling3 files
Add supervisor config for Chrome cleanup daemonAdd supervisor config for Edge cleanup daemonAdd supervisor config for Firefox cleanup daemon1 files
Duplicate Chrome binary wrapper script (possible artifact)