Skip to content
This repository has been archived by the owner on Jan 20, 2024. It is now read-only.

Lookup Chromedriver version using installed Chrome #1

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
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
20 changes: 17 additions & 3 deletions bin/compile
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,17 @@ mkdir -p $BIN_DIR
if [ -f $ENV_DIR/CHROMEDRIVER_VERSION ]; then
VERSION=$(cat $ENV_DIR/CHROMEDRIVER_VERSION)
else
topic "Looking up latest chromedriver version"
LATEST="https://chromedriver.storage.googleapis.com/LATEST_RELEASE"
VERSION=`curl -s $LATEST`
if [ -f $ENV_DIR/GOOGLE_CHROME_BIN ]; then
CHROME_BIN=$(cat $ENV_DIR/GOOGLE_CHROME_BIN)
GOOGLE_CHROME_VERSION=$("${CHROME_BIN}" --product-version | sed 's/\(.*\)\.[0-9]*$/\1/')
topic "Looking up latest chromedriver version using version $GOOGLE_CHROME_VERSION"
LATEST="https://chromedriver.storage.googleapis.com/LATEST_RELEASE_$GOOGLE_CHROME_VERSION"
VERSION=$(curl -s $LATEST)
else
topic "Looking up latest chromedriver version"
LATEST="https://chromedriver.storage.googleapis.com/LATEST_RELEASE"
VERSION=`curl -s $LATEST`
fi
fi
indent "Version $VERSION"

Expand All @@ -42,6 +50,12 @@ unzip -o $ZIP_LOCATION -d $BIN_DIR
rm -f $ZIP_LOCATION
indent "Downloaded"

if [ -x "$GOOGLE_CHROME_SHIM" ]; then
topic "Validating chromedriver"
$BIN_DIR/chromedriver --version | indent
indent "Validated"
else

topic "Creating chromedriver export scripts"
mkdir -p $BUILD_DIR/.profile.d
echo "export PATH=\$PATH:\$HOME/.chromedriver/bin" >> $BUILD_DIR/.profile.d/chromedriver.sh
Expand Down