seleniumwebscrapping / download_geckodriver.sh
Juna190825's picture
Initial Upload
7e05388 verified
#!/bin/bash
set -e # Exit immediately if any command fails
# Determine the latest version of geckodriver
echo "Fetching latest geckodriver version..."
LATEST_VERSION=$(curl -s https://api.github.com/repos/mozilla/geckodriver/releases/latest | grep -oP '"tag_name": "\K(.*)(?=")')
echo "Latest geckodriver version: $LATEST_VERSION"
# Download and extract geckodriver
echo "Downloading geckodriver..."
wget -q --show-progress https://github.com/mozilla/geckodriver/releases/download/$LATEST_VERSION/geckodriver-$LATEST_VERSION-linux64.tar.gz
echo "Extracting geckodriver..."
tar -xvzf geckodriver-$LATEST_VERSION-linux64.tar.gz
echo "Cleaning up..."
rm geckodriver-$LATEST_VERSION-linux64.tar.gz
# Ensure the file exists before changing permissions
if [ -f "geckodriver" ]; then
echo "Making geckodriver executable..."
chmod +x geckodriver
echo "Geckodriver installed successfully at $(pwd)/geckodriver"
else
echo "Error: geckodriver binary not found after extraction!" >&2
exit 1
fi