Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Test and interact with local web applications using native Python Playwright scripts
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
examples/static_html_automation.py
1from playwright.sync_api import sync_playwright2import os34# Example: Automating interaction with static HTML files using file:// URLs56html_file_path = os.path.abspath('path/to/your/file.html')7file_url = f'file://{html_file_path}'89with sync_playwright() as p:10browser = p.chromium.launch(headless=True)11page = browser.new_page(viewport={'width': 1920, 'height': 1080})1213# Navigate to local HTML file14page.goto(file_url)1516# Take screenshot17page.screenshot(path='/mnt/user-data/outputs/static_page.png', full_page=True)1819# Interact with elements20page.click('text=Click Me')21page.fill('#name', 'John Doe')22page.fill('#email', '[email protected]')2324# Submit form25page.click('button[type="submit"]')26page.wait_for_timeout(500)2728# Take final screenshot29page.screenshot(path='/mnt/user-data/outputs/after_submit.png', full_page=True)3031browser.close()3233print("Static HTML automation completed!")