Last active
May 26, 2017 09:50
-
-
Save RobinDavid/bf78f8d094a1b08bb29198804d8f278d to your computer and use it in GitHub Desktop.
Take a webpage screenshot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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