A practical, production-ready browser automation system for common web tasks: shopping, booking, form-filling, and data extraction.
- Shopping Automation: Extract product prices, availability, add to cart
- Booking Automation: Check availability, fill reservation forms
- Form Fill: Auto-fill web forms with structured data
- Data Extraction: Extract structured data (tables, lists, metadata)
- Full Logging: Every action logged with timestamps
- Screenshots: Visual confirmation at key steps
- Error Handling: Graceful failures with detailed error reporting
- Git-First: Designed for version control workflow
- Node.js 18 or higher
- npm (comes with Node.js)
- Playwright (auto-installed with
npm install)
cd automation-scripts
npm installThis will install Playwright and its dependencies. First run may take a minute as it downloads the Chromium browser.
# Extract data from a webpage
./automate.sh extract --url="https://example.com" --allThe automate.sh wrapper provides a unified interface:
./automate.sh <task-type> [options]Extract product information and optionally add to cart.
# Extract product info
./automate.sh shopping --url="https://example.com/product"
# Extract and add to cart
./automate.sh shopping --url="https://example.com/product" --add-to-cartWhat it does:
- Navigates to product page
- Extracts title, price, availability
- Screenshots the page
- Optionally clicks "Add to Cart"
- Saves results to JSON
Direct usage:
node templates/shopping.js --url="https://example.com/product" --add-to-cartCheck availability and fill booking forms.
./automate.sh booking \
--url="https://booking-site.com" \
--date="2026-02-15" \
--time="19:00" \
--party-size=2What it does:
- Navigates to booking page
- Fills date, time, party size fields
- Clicks search/submit button
- Checks availability status
- Screenshots before/after
Direct usage:
node templates/booking.js --url="..." --date="2026-02-15" --time="19:00" --party-size=2Auto-fill web forms with structured data.
./automate.sh form \
--url="https://example.com/contact" \
--data='{"name":"John Doe","email":"john@example.com","message":"Hello"}' \
--submitWhat it does:
- Navigates to form page
- Intelligently matches fields by name/id/placeholder
- Fills text, select, checkbox, radio fields
- Optionally submits the form
- Captures confirmation messages
Direct usage:
node templates/form-fill.js \
--url="..." \
--data='{"field":"value"}' \
--submitField Matching: The form filler automatically matches fields using:
- Exact name/id match
- Partial name/id match (case-insensitive)
- Placeholder text
- Data attributes
Extract structured data from any webpage.
# Extract everything (metadata, tables, lists, headings)
./automate.sh extract --url="https://example.com" --all
# Extract tables only
./automate.sh extract --url="https://example.com" --table
# Extract with custom selectors
./automate.sh extract \
--url="https://example.com" \
--selectors='{"title":"h1","price":".price","items":".product-list li"}'What it extracts:
- Metadata: title, description, Open Graph tags
- Tables: Converts HTML tables to structured JSON
- Lists: Ordered and unordered lists
- Headings: H1, H2, H3 elements
- Links: First 50 links on the page
- Custom: Any CSS selector
Direct usage:
node templates/data-extract.js --url="..." --all
node templates/data-extract.js --url="..." --selectors='{"key":"selector"}'automation-scripts/
βββ automate.sh # Wrapper script (unified interface)
βββ package.json # Node.js dependencies
βββ README.md # This file
βββ templates/ # Automation templates
β βββ shopping.js # Shopping automation
β βββ booking.js # Booking automation
β βββ form-fill.js # Form filling
β βββ data-extract.js # Data extraction
βββ logs/ # Execution logs and results
β βββ shopping.log
β βββ booking.log
β βββ form-fill.log
β βββ data-extract.log
β βββ *-result-*.json # JSON results
βββ screenshots/ # Automation screenshots
βββ *.png
For sensitive data (API keys, credentials), use environment variables:
# Example: if a site needs authentication
export SITE_USERNAME="your-username"
export SITE_PASSWORD="your-password"
# Reference in templates with process.env.SITE_USERNAMEAll templates are in templates/ and can be modified:
- Copy a template to create a new automation
- Modify selectors for specific sites
- Add custom logic for site-specific behavior
- Keep generic templates untouched for reuse
// β DON'T DO THIS
const password = "my-secret-password";
// β
DO THIS
const password = process.env.PASSWORD;Every template takes screenshots at key steps:
- Before action
- After action
- On error
Check screenshots/ to verify automation behavior.
All actions are logged with timestamps:
[2026-02-07T10:30:00.000Z] Starting shopping automation for: https://example.com
[2026-02-07T10:30:02.000Z] Navigating to product page...
[2026-02-07T10:30:05.000Z] Extracting product information...
Check logs/*.log for detailed execution history.
All templates include:
- 30-second navigation timeout
- Graceful failure on missing elements
- Error screenshots
- Structured error reporting
Be respectful of websites:
- Don't run automations in tight loops
- Add delays between requests if scraping multiple pages
- Check site's
robots.txtand terms of service
cd automation-scripts
npm installThe form filler couldn't match a field. Solutions:
- Check the page HTML to find the actual field name/id
- Use custom selectors in the data extraction template
- Modify the template to add site-specific selectors
The page took too long to load:
- Check your internet connection
- Try increasing timeout in the template
- Some sites block automated browsers (see Stealth Mode below)
Some sites detect automation. To improve stealth:
- Add delays:
await page.waitForTimeout(2000) - Use residential proxies (not included in prototype)
- Randomize user agents
- Consider playwright-stealth plugin
# Extract data, then use it to fill a form
PRODUCT_DATA=$(./automate.sh extract --url="..." --selectors='{"price":".price"}')
PRICE=$(echo $PRODUCT_DATA | jq -r '.data.custom.price')
./automate.sh form --url="..." --data="{\"price\":\"$PRICE\"}"Templates work in headless mode by default (no GUI):
# GitHub Actions example
- name: Run automation
run: |
cd automation-scripts
npm install
./automate.sh extract --url="https://example.com" --allCreate new templates by copying existing ones:
cp templates/shopping.js templates/my-custom-automation.js
# Edit my-custom-automation.js
# Run with: node templates/my-custom-automation.jsAll automations output JSON to stdout (last line):
{
"success": true,
"data": {
"title": "Product Name",
"price": "$29.99",
"availability": "In Stock"
}
}Parse with jq:
./automate.sh shopping --url="..." | jq -r '.data.price'Detailed logs in logs/:
shopping.log,booking.log, etc.: execution logs*-result-*.json: structured results with timestamps
This is a prototype. To extend:
- Add new templates in
templates/ - Update
automate.shto route new task types - Document in this README
- Commit with descriptive messages
This is a prototype for practical automation. Use responsibly and ethically. Always respect website terms of service and robots.txt.
Built with β€οΈ for practical automation needs.