Skip to content

Instantly share code, notes, and snippets.

@AlainPilon
Forked from jsok/phantom.py
Last active January 5, 2018 16:14
Show Gist options
  • Save AlainPilon/dd6aaebcaeeaf151831899578888d044 to your computer and use it in GitHub Desktop.
Save AlainPilon/dd6aaebcaeeaf151831899578888d044 to your computer and use it in GitHub Desktop.
Use PhantomJS and Python Selenium bindings to take screenshots of websites.
from io import BytesIO
from selenium import webdriver
from PIL import Image
driver = webdriver.PhantomJS()
driver.set_window_size(1366, 728) # optional
driver.get('http://google.com')
driver.save_screenshot('screen_hires.png')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment