Install chromedriver and hardcoded selenium server

This commit is contained in:
AndreyMaslennikov
2019-12-18 17:16:23 +03:00
parent 9786a9946a
commit 84a404c4ee

View File

@@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
################################################################################ ################################################################################
## File: google-chrome.sh ## File: google-chrome.sh
## Desc: Installs google-chrome ## Desc: Installs google-chrome, chromedriver and selenium server
################################################################################ ################################################################################
# Source the helpers for use with the script # Source the helpers for use with the script
@@ -25,3 +25,31 @@ fi
# Document what was added to the image # Document what was added to the image
echo "Lastly, documenting what we added to the metadata file" echo "Lastly, documenting what we added to the metadata file"
DocumentInstalledItem "Google Chrome ($(google-chrome --version))" 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