Skip to content

Instantly share code, notes, and snippets.

@iComputerfreak
Created June 17, 2020 15:52
Show Gist options
  • Save iComputerfreak/0f04f505fecc70058cf96c9b66f30e31 to your computer and use it in GitHub Desktop.
Save iComputerfreak/0f04f505fecc70058cf96c9b66f30e31 to your computer and use it in GitHub Desktop.
Takes a full page screenshot of a website using Selenium and Firefox with a delay of 1 second.
from selenium import webdriver
from selenium.webdriver.firefox.options import Options
import sys
import time
# Get the url and name
if len(sys.argv) != 3:
print("Usage: " + sys.argv[0] + " <File> <URL>")
sys.exit()
file = sys.argv[1]
url = sys.argv[2]
options = Options()
options.add_argument( "--headless" )
driver = webdriver.Firefox( firefox_options=options )
driver.get(url)
time.sleep(1)
el = driver.find_element_by_tag_name('body')
el.screenshot(file)
driver.quit()
sys.exit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment