Skip to content

Instantly share code, notes, and snippets.

@Seif-apprentus
Last active April 4, 2025 08:14
Show Gist options
  • Save Seif-apprentus/9bb29416ef69f0c01d61d900dedfdcb7 to your computer and use it in GitHub Desktop.
Save Seif-apprentus/9bb29416ef69f0c01d61d900dedfdcb7 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Get the installed Chrome version (full version including the fourth segment)
CHROME_VERSION=$(google-chrome --version | awk '{print $3}' | cut -d '.' -f1-4)
# Construct the ChromeDriver URL
CHROMEDRIVER_URL="https://storage.googleapis.com/chrome-for-testing-public/${CHROME_VERSION}/linux64/chromedriver-linux64.zip"
echo "πŸš€ Detected Chrome version: $CHROME_VERSION"
echo "πŸ”— Downloading ChromeDriver from: $CHROMEDRIVER_URL"
# Download the ChromeDriver
wget -O chromedriver.zip "$CHROMEDRIVER_URL"
# Check if the download was successful
if [ $? -ne 0 ]; then
echo "❌ Failed to download ChromeDriver. Check the version or URL."
exit 1
fi
# Unzip the downloaded file
unzip -o chromedriver.zip
# Remove the old ChromeDriver
sudo rm -f /usr/local/bin/chromedriver
# Move the new ChromeDriver to the correct location
sudo mv chromedriver-linux64/chromedriver /usr/local/bin/
# Make it executable
sudo chmod +x /usr/local/bin/chromedriver
# Clean up the downloaded zip file
rm -f chromedriver.zip
# Verify the installed version
echo "βœ… Installed ChromeDriver version:"
chromedriver -v
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment