Created
June 17, 2020 15:52
-
-
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.
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 | |
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