Skip to content

Instantly share code, notes, and snippets.

@tirinox
Created May 1, 2019 17:04
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save tirinox/d9d7e42bcb1b624eb245d88cc209d1c0 to your computer and use it in GitHub Desktop.
Make a screenshot of any webpage using Python, Selenium and Chrome
# 1) pip install selenium
# 2) ChromeDriver: http://chromedriver.chromium.org/downloads
from selenium import webdriver
DRIVER = 'chromedriver'
driver = webdriver.Chrome(DRIVER)
driver.get('https://erugame.ru/') # какой сайт
driver.save_screenshot("screenshot.png")
# если надо скриншот страницы целиком с прокруткой до низа:
element = driver.find_element_by_tag_name('body')
element.screenshot("screenshot_full.png")
driver.quit()
@moonzlo
Copy link

moonzlo commented Jan 31, 2023

It doesn't work...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment