aboutsummaryrefslogtreecommitdiff
path: root/playwright-py
diff options
context:
space:
mode:
Diffstat (limited to 'playwright-py')
-rw-r--r--playwright-py/SKILL.md8
1 files changed, 7 insertions, 1 deletions
diff --git a/playwright-py/SKILL.md b/playwright-py/SKILL.md
index 1dee60e..0ed912b 100644
--- a/playwright-py/SKILL.md
+++ b/playwright-py/SKILL.md
@@ -54,7 +54,7 @@ To create an automation script, include only Playwright logic (servers are manag
from playwright.sync_api import sync_playwright
with sync_playwright() as p:
- browser = p.chromium.launch(headless=True) # Always launch chromium in headless mode
+ browser = p.chromium.launch(headless=True) # headless for CI/pytest; headless=False for interactive debugging
page = browser.new_page()
page.goto('http://localhost:5173') # Server already running and ready
page.wait_for_load_state('networkidle') # CRITICAL: Wait for JS to execute
@@ -87,6 +87,12 @@ with sync_playwright() as p:
- Always close the browser when done
- Use descriptive selectors: `text=`, `role=`, CSS selectors, or IDs
- Add appropriate waits: `page.wait_for_selector()` or `page.wait_for_timeout()`
+- **Choose headed vs headless by purpose, not habit.** This skill defaults to *headless* (`headless=True`) because it targets CI and pytest. The companion `/playwright-js` defaults to *headed* for interactive visual debugging. Pick by what you're doing, and only override when the purpose flips:
+
+ | Purpose | Mode |
+ |---|---|
+ | CI, pytest, smoke tests, unattended runs | headless (`headless=True`) |
+ | Interactive debugging, watching a flow | headed (`headless=False`) |
## Reference Files