Ubuntu Serverにfirefox headless

Headless

wget https://github.com/mozilla/geckodriver/releases/download/v0.23.0/geckodriver-v0.23.0-linux64.tar.gz
tar -zxvf geckodriver-v0.23.0-linux64.tar.gz 

sudo chmod +x geckodriver
sudo mv geckodriver /usr/local/bin

sudo apt install firefox
sudo apt install python3-pip
pip3 install selenium --user
sudo apt install xvfb
/usr/bin/Xvfb :99 -ac -screen 0 1024x768x8 & export DISPLAY=":99"
from selenium import webdriver
#from selenium.webdriver.firefox.options import Options

#options = Options()
#options.headless = True
#driver = webdriver.Firefox(options=options)

driver = webdriver.Firefox()

driver.get('http://www.yahoo.co.jp')

# ブラウザ操作
driver.save_screenshot("ss.png")

driver.quit()