Skip to content

Instantly share code, notes, and snippets.

@RobinDavid
Last active May 26, 2017 09:50
Show Gist options
  • Save RobinDavid/bf78f8d094a1b08bb29198804d8f278d to your computer and use it in GitHub Desktop.
Save RobinDavid/bf78f8d094a1b08bb29198804d8f278d to your computer and use it in GitHub Desktop.
Take a webpage screenshot
from selenium import webdriver
import sys
url_input = ("file://" if not sys.argv[1].startswith("http") else "") + sys.argv[1]
image_output = sys.argv[2]
driver = webdriver.Chrome() # or PhantomJS() not to open a windows (require phantomjs)
driver.get(url_input)
if driver.save_screenshot(image_output):
print("Save ok !")
driver.quit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment