I wrote a program that captures homepage images using python and selenium.
# -*- coding: utf-8 -*-
import sys
from selenium import webdriver
from selenium.webdriver import FirefoxOptions
'''
Start Firefox and capture the image
'''
if( len( sys.argv ) < 3 ):
print "Usage: firefox.py [uri] [png]"
sys.exit( 1 )
opts = FirefoxOptions()
opts.add_argument( "--headless" )
driver = webdriver.Firefox( firefox_options = opts )
driver.set_window_size( 1024,768 )
driver.get( sys.argv[1] )
driver.save_screenshot( sys.argv[2] )
driver.quit()
Recommended Posts