Skip to content

Instantly share code, notes, and snippets.

@nathanielatom
Created September 6, 2017 23:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nathanielatom/db018a15df2395d042cbbb894a2a7e25 to your computer and use it in GitHub Desktop.
Save nathanielatom/db018a15df2395d042cbbb894a2a7e25 to your computer and use it in GitHub Desktop.
# Mac
brew cask install chromium
pip install selenium
wget https://chromedriver.storage.googleapis.com/2.32/chromedriver_mac64.zip
unzip chromedriver_mac64.zip -d /usr/local/bin/
rm chromedriver_mac64.zip
# python
from selenium import webdriver
options = webdriver.ChromeOptions()
options.binary_location = '/Applications/Chromium.app/Contents/MacOS/Chromium'
options.add_argument('headless')
options.add_argument('window-size=1800x1100')
driver = webdriver.Chrome(chrome_options=options)
driver.get('data:...')
driver.get_screenshot_as_base64() # TODO use PrintPDF of headless chrome
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment