Skip to content

screenshotone/python-selenium-examples

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Python Selenium Website Screenshots Example

A repository of working and tested Selenium scripts for taking website screenshots.

For more information, check out our ScreenshotOne guide on how to use Selenium with Python to take website screenshots.

Requirements

  • Python 3.8+
  • Google Chrome installed

Setup

python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt

Usage

Screenshot a page (headless by default):

python screenshot.py https://example.com -o screenshots/example.png

Screenshot a specific element:

python screenshot.py https://example.com -o screenshots/hero.png --element ".hero"

Full page screenshot (scroll and stitch):

python screenshot.py https://example.com -o screenshots/full.png --full-page

Run with a visible browser window:

python screenshot.py https://example.com --headed

Notes

  • webdriver-manager downloads the correct ChromeDriver automatically.
  • Output directories are created if they do not exist.
  • pillow is used for stitching full-page screenshots.

License

The project is licensed under the MIT license.

About

Working and tested Selenium (Python) scripts for taking website screenshots

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages