diff --git a/images/linux/scripts/installers/google-chrome.sh b/images/linux/scripts/installers/google-chrome.sh index 5fa862b74..437f56eda 100644 --- a/images/linux/scripts/installers/google-chrome.sh +++ b/images/linux/scripts/installers/google-chrome.sh @@ -1,7 +1,7 @@ #!/bin/bash ################################################################################ ## File: google-chrome.sh -## Desc: Installs google-chrome +## Desc: Installs google-chrome, chromedriver and selenium server ################################################################################ # Source the helpers for use with the script @@ -25,3 +25,31 @@ fi # Document what was added to the image echo "Lastly, documenting what we added to the metadata file" DocumentInstalledItem "Google Chrome ($(google-chrome --version))" + +CHROME_VERSION=$(google-chrome --version | grep -Eo "([0-9]+\.?){4}" | cut -d "." -f 1,2,3) +echo "Current Google Chrome version: $CHROME_VERSION" + +# Determine latest release of chromedriver +LATEST_RELEASE_FILENAME="LATEST_RELEASE_$CHROME_VERSION" +wget "https://chromedriver.storage.googleapis.com/$LATEST_RELEASE_FILENAME" +LATEST_CHROMEDRIVER_VERSION=$(cat $LATEST_RELEASE_FILENAME) +rm $LATEST_RELEASE_FILENAME + +# Download and unpack latest release of chromedriver +echo "Downloading chromedriver v$LATEST_CHROMEDRIVER_VERSION..." +wget "https://chromedriver.storage.googleapis.com/$LATEST_CHROMEDRIVER_VERSION/chromedriver_linux64.zip" +unzip chromedriver_linux64.zip +rm chromedriver_linux64.zip +mv chromedriver /usr/bin/chromedriver +chown root:root /usr/bin/chromedriver +chmod +x /usr/bin/chromedriver + +# Run tests to determine that the chromedriver installed as expected +if ! command -v chromedriver; then + echo "chromedriver was not installed" + exit 1 +fi + +# Download selenium standalone server (hardcoded version 3.141.59) +echo "Downloading selenium-server-standalone v3.141.59..." +wget https://selenium-release.storage.googleapis.com/3.141/selenium-server-standalone-3.141.59.jar \ No newline at end of file