Skip to content

Fix setup reliability, add Xvfb headed mode, improve inline execution#12

Merged
a5m0 merged 2 commits intomainfrom
claude/check-browser-fingerprint-SF8o0
Feb 19, 2026
Merged

Fix setup reliability, add Xvfb headed mode, improve inline execution#12
a5m0 merged 2 commits intomainfrom
claude/check-browser-fingerprint-SF8o0

Conversation

@a5m0
Copy link
Owner

@a5m0 a5m0 commented Feb 19, 2026

Summary

  • Setup script no longer depends on $CLAUDE_PROJECT_DIR — resolves skill directory from the script's own location via BASH_SOURCE[0], which always works. Also verifies the installed patchright is actually from the vendor wheel (not PyPI) and reinstalls if needed, installs trafilatura alongside patchright, and adds --system to all uv pip calls for non-venv environments.
  • Headed browser mode via Xvfbget_browser_config(headless=False) now auto-starts an Xvfb virtual display in web/CI environments. This gives better anti-bot evasion since some detection systems fingerprint headless browsers. Xvfb is installed by the setup script and also attempted at runtime as a fallback. Gracefully degrades to headless if Xvfb is unavailable.
  • Simpler inline execution for common tasks — the run.py executor now auto-detects when inline code references page without creating its own browser, and provides pre-configured browser, context, page, plus all helper functions. Simple tasks become one-liners (await page.goto(...); print(await page.title())) with automatic setup and teardown.

Changes

scripts/setup-session.sh

  • Resolve skill dir from script location (first priority, always works)
  • Detect vendor wheel vs PyPI install and reinstall patched wheel if needed
  • Install patchright + trafilatura in one pass
  • Install Xvfb via apt-get (non-fatal)
  • Add --system to all uv pip calls
  • Fix patchright.__version__ attribute check

skills/playwright-skill/lib/proxy_wrapper.py

  • Add ensure_virtual_display() / stop_virtual_display()
  • Xvfb auto-install fallback at runtime via apt-get
  • get_browser_config(headless=False) starts Xvfb + passes env to Chrome
  • New xvfb_used key in config dict

skills/playwright-skill/run.py

  • Add auto-configured inline mode (detects page. usage, provides full setup)
  • Manual inline mode unchanged (detects p.chromium.launch)
  • Fix multiline code indentation in all wrapper templates
  • Add stop_virtual_display() cleanup to finally blocks
  • Add --system to uv pip fallback installer

skills/playwright-skill/SKILL.md

  • Document Xvfb headed mode and when to use it
  • Document auto-configured vs manual inline execution
  • Show available helpers in auto-configured mode

skills/playwright-skill/lib/helpers.py

  • Export ensure_virtual_display / stop_virtual_display
  • Add xvfb_used to stub get_browser_config()

Test plan

  • Setup script works with empty $CLAUDE_PROJECT_DIR
  • Setup script detects existing vendor wheel install
  • get_browser_config() defaults to headless in web env
  • get_browser_config(headless=False) starts Xvfb and Chrome connects
  • Auto-configured inline: await page.goto(...) works without boilerplate
  • Manual inline: p.chromium.launch(...) still works
  • Complete scripts passed through unchanged
  • Content extraction via extract_markdown() in auto-configured mode
  • take_screenshot() in auto-configured mode
  • Xvfb cleanup on exit

Setup script:
- Resolve skill dir from script location (works without CLAUDE_PROJECT_DIR)
- Verify vendor wheel vs PyPI install and reinstall if needed
- Install trafilatura alongside patchright in one pass
- Add --system flag to all uv pip commands for non-venv environments
- Fix __version__ attribute access for patchright version check

Xvfb virtual display:
- Add ensure_virtual_display() / stop_virtual_display() to proxy_wrapper
- get_browser_config(headless=False) auto-starts Xvfb in web environments
- Pass DISPLAY explicitly to Chrome via launch env for reliable detection
- Graceful fallback to headless if Xvfb unavailable
- Enables headed mode for better anti-bot evasion in headless environments

Inline execution:
- Auto-detect when code needs pre-configured browser/page vs manual setup
- Auto-configured mode: provides browser, context, page, helpers, cleanup
- Simple tasks like "await page.goto(...)" just work without boilerplate
- Manual mode still available when code uses p.chromium.launch()
- Fix multiline code indentation in all wrapper templates
- Add stop_virtual_display() cleanup to all wrapper finally blocks

https://claude.ai/code/session_011rNycMwFzJkx8UNqb5kGxh
Setup script now installs xvfb via apt-get during session startup
(non-fatal if it fails). The Python ensure_virtual_display() also
attempts apt-get install as a runtime fallback before giving up
and falling back to headless mode.

https://claude.ai/code/session_011rNycMwFzJkx8UNqb5kGxh
@a5m0 a5m0 merged commit d824846 into main Feb 19, 2026
1 check passed
@a5m0 a5m0 deleted the claude/check-browser-fingerprint-SF8o0 branch February 19, 2026 21:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants