Last active
April 4, 2025 08:14
-
-
Save Seif-apprentus/9bb29416ef69f0c01d61d900dedfdcb7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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