Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Install & test Selenium with Firefox / Gecko driver on headless Ubuntu 18.04 LTS server
sudo apt update
sudo apt install firefox python3-pip xvfb x11-utils --yes
sudo -H pip3 install bpython selenium
export DISPLAY=:2
Xvfb $DISPLAY -ac &
export GECKO_DRIVER_VERSION='v0.24.0'
tar -xvzf geckodriver-$GECKO_DRIVER_VERSION-linux64.tar.gz
rm geckodriver-$GECKO_DRIVER_VERSION-linux64.tar.gz
chmod +x geckodriver
sudo cp geckodriver /usr/local/bin/
cat <<EOF >
#!/usr/bin/env python3
from selenium.webdriver import Firefox, FirefoxOptions, FirefoxProfile
ff_options = FirefoxOptions()
ff_options.headless = True
ff = Firefox(options=ff_options)
chmod +x
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment