Last active
July 31, 2025 00:10
-
-
Save BigAlRender/41f4c4d87df3e25770e3db8db728443e to your computer and use it in GitHub Desktop.
Install Chrome on Render Native Environment
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
#!/usr/bin/env bash | |
# exit on error | |
set -o errexit | |
STORAGE_DIR=/opt/render/project/.render | |
if [[ ! -d $STORAGE_DIR/chrome ]]; then | |
echo "...Downloading Chrome" | |
mkdir -p $STORAGE_DIR/chrome | |
cd $STORAGE_DIR/chrome | |
wget -P ./ https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb | |
dpkg -x ./google-chrome-stable_current_amd64.deb $STORAGE_DIR/chrome | |
rm ./google-chrome-stable_current_amd64.deb | |
cd $HOME/project/src # Make sure we return to where we were | |
else | |
echo "...Using Chrome from cache" | |
fi | |
# be sure to add Chromes location to the PATH as part of your Start Command | |
# export PATH="${PATH}:/opt/render/project/.render/chrome/opt/google/chrome" | |
# add your own build commands... |
I was having an issue with this script with an error saying it couldnt locate the chrome driver. So I added this right under it and it worked!
if [[ ! -f $STORAGE_DIR/chromedriver/chromedriver ]]; then
echo "...Downloading Chromedriver"
mkdir -p $STORAGE_DIR/chromedriver
cd $STORAGE_DIR/chromedriver
wget https://storage.googleapis.com/chrome-for-testing-public/124.0.6367.78/linux64/chromedriver-linux64.zip
unzip chromedriver-linux64.zip
mv chromedriver-linux64/chromedriver .
rm -r chromedriver-linux64 chromedriver-linux64.zip
else
echo "...Using cached Chromedriver"
fi
cd $HOME/project/src
make sure the version of chrome driver matches the chrome driver. You can check that by adding this to your build.sh on render to see the version:
$STORAGE_DIR/chrome/opt/google/chrome/google-chrome --version
Also be sure to correctly set paths in your selenium script to reflect this.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for the script. I was getting EOF errors when running dpkg -x so had to split the command for it to work.
ar x google-chrome-stable_current_amd64.deb
tar -xf data.tar.xz -C $STORAGE_DIR/chrome