AutoShot is a lightweight Python tool that validates a URL, opens it in Google Chrome (headless or visible), takes a screenshot, and saves it locally. Built with Selenium and simple regex, it’s perfect for quick web snapshots and learning browser automation.
✅ Validates URLs with regex
👀 Runs Chrome in headless (background) or visible mode
💾 Saves screenshots in the images/ folder with your chosen filename
🧩 Clean, modular code structure for easy maintenance
auto-shot/ ├── automation.py # Browser automation and screenshot logic ├── url_validation.py # URL validation using regex ├── url.py # User input for URLs ├── run.py # Main runner script ├── requirements.txt # Python dependencies ├── images/ # Screenshots saved here (create if missing) └── README.md # This file
Python 3.8+
Google Chrome installed
-
Clone or download this repo
-
Install dependencies:
pip install -r requirements.txt
Example requirements.txt:
selenium==4.34.4 webdriver-manager
Run the script from the project root:
python run.py
Follow the prompts:
🌐 Enter the URL (e.g., https://www.example.com)
💤 Run Chrome in headless mode? (y/n)
📸 Choose a name for your screenshot
The screenshot will save as images/<your_name>.png.
webdriver-manager auto-downloads the correct ChromeDriver version for you.
If driver download hangs (e.g., behind a firewall), try VPN or manual ChromeDriver install.
Test script for debugging driver issues:
from selenium import webdriver from selenium.webdriver.chrome.service import Service from webdriver_manager.chrome import ChromeDriverManager import time
options = webdriver.ChromeOptions()
service = Service(ChromeDriverManager().install()) driver = webdriver.Chrome(service=service, options=options) driver.get("https://www.google.com") time.sleep(5) driver.quit()
MIT License — see the LICENSE file for details.
If you want me to generate requirements.txt, LICENSE, or even a demo GIF for this README, just ask! 😊