원클릭으로
playwright
Render web pages with JavaScript using Playwright for sites that need browser rendering or have issues with simple HTTP fetching.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Render web pages with JavaScript using Playwright for sites that need browser rendering or have issues with simple HTTP fetching.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Publish dynamic web pages for dashboards, trackers, or any data viewable in a browser. Server-side Python runs on every request.
Extract and summarise content from URLs, YouTube videos, podcasts, and files. Use when the user shares a link, asks "what's this about", "summarise this", wants a transcript, or references web/video/podcast content.
Fetch X/Twitter timeline and bookmarks. Use when the user asks about their Twitter feed, "what's on my timeline", "my bookmarks", "what have I bookmarked", or wants raw tweet data.
General-purpose lists — shopping, questions for appointments, packing lists, etc. Use when the user wants to create a list, add items, "shopping list", "questions for appointments", "what's on my list", or manages grouped items around a theme or event.
Manage reminders — one-off and recurring. Use when the user says "remind me", "set a reminder", "what reminders do I have", "cancel that reminder", or needs time-based nudges. Wraps the cron system with history and categories.
Personal knowledge base using the Zettelkasten method. Use when the user wants to save a note, look up knowledge, connect ideas, "what do I know about X", "save this", "note this down", or asks about their notes/knowledge base.
| name | playwright |
| description | Render web pages with JavaScript using Playwright for sites that need browser rendering or have issues with simple HTTP fetching. |
Use Playwright to render JavaScript-heavy websites, take screenshots, and extract content that regular HTTP fetching can't handle.
Playwright will be installed automatically via uv dependencies, but you may need to install browsers:
# Install browsers (run once)
playwright install chromium
# Or for all browsers
playwright install
uv run - "https://example.com" <<'EOF'
# /// script
# requires-python = ">=3.12"
# dependencies = ["playwright>=1.0", "beautifulsoup4>=4.0"]
# ///
import sys
from playwright.sync_api import sync_playwright
if len(sys.argv) < 2:
print("Usage: script <url>")
sys.exit(1)
url = sys.argv[1]
print(f"🎭 Rendering: {url}")
with sync_playwright() as p:
browser = p.chromium.launch(headless=True)
page = browser.new_page()
try:
# Navigate and wait for page to load
page.goto(url, wait_until='networkidle')
# Get basic info
title = page.title()
content = page.content()
print(f"✅ Page loaded successfully")
print(f"📄 Title: {title}")
print(f"📏 Content length: {len(content)} characters")
print(f"🔗 Final URL: {page.url}")
# Extract and clean text content
text_content = page.evaluate("""
() => {
// Remove script and style elements
const scripts = document.querySelectorAll('script, style, nav, header, footer');
scripts.forEach(el => el.remove());
// Get main content
const main = document.querySelector('main, article, .content, .post, .entry') || document.body;
return main.innerText || document.body.innerText;
}
""")
# Clean and limit output
clean_text = '\n'.join(line.strip() for line in text_content.split('\n') if line.strip())
print(f"\n📝 EXTRACTED CONTENT:")
print("=" * 80)
print(clean_text[:3000]) # First 3000 chars
if len(clean_text) > 3000:
print(f"\n... (truncated, full content is {len(clean_text)} characters)")
except Exception as e:
print(f"❌ Error loading page: {e}")
finally:
browser.close()
EOF
uv run - "https://example.com" "screenshot.png" <<'EOF'
# /// script
# requires-python = ">=3.12"
# dependencies = ["playwright>=1.0"]
# ///
import sys
from playwright.sync_api import sync_playwright
from pathlib import Path
if len(sys.argv) < 2:
print("Usage: script <url> [output_file]")
sys.exit(1)
url = sys.argv[1]
output_file = sys.argv[2] if len(sys.argv) > 2 else "screenshot.png"
print(f"📸 Taking screenshot of: {url}")
with sync_playwright() as p:
browser = p.chromium.launch(headless=True)
page = browser.new_page()
# Set viewport size
page.set_viewport_size({"width": 1280, "height": 720})
try:
page.goto(url, wait_until='networkidle')
# Take full page screenshot
page.screenshot(path=output_file, full_page=True)
# Get file size
file_size = Path(output_file).stat().st_size
print(f"✅ Screenshot saved: {output_file} ({file_size:,} bytes)")
print(f"📄 Page title: {page.title()}")
except Exception as e:
print(f"❌ Error taking screenshot: {e}")
finally:
browser.close()
EOF
If a method call fails or you're unsure what's available on the page object, introspect it:
uv run -c "from playwright.sync_api import Page; print([m for m in dir(Page) if not m.startswith('_')])"
For full library docs, fetch the README:
webfetch https://github.com/microsoft/playwright-python
page.wait_for_timeout(ms) for slow-rendering JSUse this when the built-in webfetch tool encounters: