Skip to content

Instantly share code, notes, and snippets.

@cgoldberg
Last active April 20, 2025 03:54
Show Gist options
  • Save cgoldberg/00b94c8d1f1f521756817b25db05e4a8 to your computer and use it in GitHub Desktop.
Save cgoldberg/00b94c8d1f1f521756817b25db05e4a8 to your computer and use it in GitHub Desktop.
Bash script to download Selenium Manager binary for Linux to current directory
#!/usr/bin/env bash
#
# This script downloads the latest stable version of the `selenium-manager` binary
# for Linux (x86-64) from `https://github.com/SeleniumHQ/selenium_manager_artifacts/releases`
#
# When you run this script, it will download the binary to the current working directory.
set -e
if [ ! "$(uname -s)" == "Linux" ]; then
echo "this script only works on Linux"
exit 1
fi
sel_mgr_bin="selenium-manager"
sel_build_url="https://github.com/SeleniumHQ/selenium/blob/trunk/common/selenium_manager.bzl"
sel_mgr_url=$(
curl -s "${sel_build_url}" 2>/dev/null | \
grep -oE "url = .*?${sel_mgr_bin}-linux" | \
cut -d= -f2 | cut -c4-
)
echo "downloading ${sel_mgr_url} ..."
wget --quiet --hsts-file=/dev/null "${sel_mgr_url}" -O "${sel_mgr_bin}"
if [ -f "${sel_mgr_bin}" ]; then
chmod +x "${sel_mgr_bin}"
echo "downloaded binary: ${sel_mgr_bin}"
else
echo "oops... can't find the binary"
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment