{"id":50962785,"url":"https://github.com/iliaal/edge-cdp","last_synced_at":"2026-06-18T16:30:36.933Z","repository":{"id":352656826,"uuid":"1215427083","full_name":"iliaal/edge-cdp","owner":"iliaal","description":"Unified Microsoft Edge launcher and Playwright CDP helper for multi-profile WSL workflows","archived":false,"fork":false,"pushed_at":"2026-04-20T14:43:48.000Z","size":16,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-04-20T16:41:06.570Z","etag":null,"topics":["browser-automation","cdp","chromium","edge","pdf","playwright","wsl","wsl2"],"latest_commit_sha":null,"homepage":"https://github.com/iliaal/edge-cdp","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/iliaal.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-04-19T22:30:12.000Z","updated_at":"2026-04-20T14:45:25.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/iliaal/edge-cdp","commit_stats":null,"previous_names":["iliaal/edge-cdp"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/iliaal/edge-cdp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iliaal%2Fedge-cdp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iliaal%2Fedge-cdp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iliaal%2Fedge-cdp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iliaal%2Fedge-cdp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iliaal","download_url":"https://codeload.github.com/iliaal/edge-cdp/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iliaal%2Fedge-cdp/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34499403,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-18T02:00:06.871Z","response_time":128,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["browser-automation","cdp","chromium","edge","pdf","playwright","wsl","wsl2"],"created_at":"2026-06-18T16:30:31.319Z","updated_at":"2026-06-18T16:30:36.924Z","avatar_url":"https://github.com/iliaal.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# edge-cdp\n\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)\n[![Python 3.11+](https://img.shields.io/badge/python-3.11%2B-blue?logo=python\u0026logoColor=white)](https://www.python.org/)\n[![Platform: WSL · Linux · macOS](https://img.shields.io/badge/platform-WSL%20%C2%B7%20Linux%20%C2%B7%20macOS-lightgrey)](#)\n[![Follow @iliaa](https://img.shields.io/badge/Follow-@iliaa-000000?style=flat\u0026logo=x\u0026logoColor=white)](https://x.com/intent/follow?screen_name=iliaa)\n\n![edge-cdp](images/edge-cdp-hero.jpg)\n\nUnified launcher and Playwright CDP helper for Microsoft Edge (and Chrome). Manages multiple named profiles, each on its own debug port and user-data directory. Replaces ad-hoc per-repo `launch-edge.sh` scripts when several tools need an authenticated browser session for automation or PDF capture.\n\nDesigned primarily for WSL (Windows-side Edge driven from a Linux shell). Works on native Linux and macOS too.\n\n## 🚀 Quick Start\n\n```bash\ngit clone https://github.com/iliaal/edge-cdp\ncd edge-cdp\nuv sync\nuv tool install --editable .\npython3 -m pip install --user -e .   # so the system python3 can import edge_cdp\n```\n\n`edge-cdp` lands in `~/.local/bin`. First run copies `profiles.example.toml` to `~/.config/edge-cdp/profiles.toml`. Edit that file (or use `edge-cdp profile add`) to set up your real profiles.\n\n```bash\nedge-cdp launch work                                  # spawn the 'work' profile\nedge-cdp pdf work https://example.com report.pdf      # capture a page as PDF\nedge-cdp profile list                                 # show configured profiles\n```\n\n## 🔗 Used by\n\n[whetstone](https://github.com/iliaal/whetstone)'s `scripts/post-thread.py` drives the X compose box over CDP using the `compound-engineering` profile on port 9225. Same shape works for any browser automation that needs a persistent, authenticated session without re-logging-in.\n\n## 🛠️ CLI\n\n```\nedge-cdp status                              # list profiles, show alive/dead per port\nedge-cdp launch \u003cprofile\u003e                    # spawn if dead, no-op if alive\nedge-cdp ensure \u003cprofile\u003e                    # alias for launch (script-friendly)\nedge-cdp shell \u003cprofile\u003e -- CMD ARGS...      # run CMD with CDP_URL + EDGE_PROFILE in env\nedge-cdp profile list\nedge-cdp profile add NAME [--port N] [--data-dir PATH] [--browser edge|chrome] [--purpose TEXT] [--bind-all]\nedge-cdp profile remove NAME\nedge-cdp pdf \u003cprofile\u003e URL OUT [--tall] [--viewport WxH] [--wait SECS] [--media screen|print] [--stamp [top|bottom]]\n```\n\n`profile add` auto-picks the next free CDP port starting at 9225 and defaults the data directory to `C:\\Users\\\u003cwsl-user\u003e\\edge-\u003cname\u003e` on WSL (override with `--data-dir`, or set `WIN_USER` in the environment if your Windows username differs from your WSL `$USER`).\n\n## 📚 Library\n\n```python\nfrom edge_cdp import ensure_running, connect, capture_pdf\n\nensure_running(\"work\")\npw, browser, context, page = connect(\"work\")\n\ncapture_pdf(\n    profile=\"work\",\n    url=\"https://example.com/some-page\",\n    out=\"page.pdf\",\n    viewport=(1280, 900),\n    wait_seconds=2,\n)\n```\n\nPDF defaults: `emulate_media(\"screen\")`, `print_background=True`, A4, 10mm margins. Pass `tall=True` for a single-page render at `body.scrollHeight` (useful for archival captures where pagination breaks layouts).\n\nPass `stamp=\"bottom\"` or `stamp=\"top\"` (CLI: `--stamp bottom` / `--stamp top`; bare `--stamp` defaults to bottom) to add a header or footer with the captured URL, UTC retrieval timestamp, and page numbers. The matching margin is bumped to 18mm to fit; in tall mode the height is padded so content doesn't clip.\n\n## ✨ Multiple profiles in parallel\n\nDifferent profiles on different ports run simultaneously. Edge spawns a separate process per `--user-data-dir`, so `edge-cdp ensure work` and `edge-cdp ensure personal` can both run without conflict.\n\nThe \"close all Edge windows\" warning sometimes seen in older recipes only applies when something else is already using the *same* user-data-dir as a profile you are trying to launch.\n\n## 🔒 Security: localhost binding by default\n\nThe CDP debug port is bound to `127.0.0.1` by default, so only processes on the same machine can connect. This matters because anyone who reaches the port has full control of the browser, including reading every cookie and session for every domain you are logged into.\n\nIf you genuinely need LAN access (e.g., driving the browser from a different host), opt in per profile:\n\n```bash\nedge-cdp profile add lan-accessible --bind-all\n```\n\nOr edit `~/.config/edge-cdp/profiles.toml` and add `bind_all = true` under the profile section. Existing profiles default to localhost-only on next launch.\n\n## 📄 Why screen-media + background-graphics defaults\n\nBrowsers default to print CSS when rendering to PDF, including via CDP `Page.printToPDF`. Many sites' `@media print` rules collapse multi-column layouts and turn icon fonts into glyph boxes. `emulate_media(\"screen\")` prevents that. `print_background=True` preserves background colors and images, which dashboard-style pages rely on. `capture_pdf` bakes both in so you don't have to remember.\n\nOverride with `media=\"print\"` if you actually want the print stylesheet.\n\n## License\n\nMIT. See [LICENSE](LICENSE).\n\n---\n\n[Follow @iliaa on X](https://x.com/iliaa) • [Blog](https://ilia.ws) • If this killed your launch-edge.sh hack, ⭐ star it!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Filiaal%2Fedge-cdp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Filiaal%2Fedge-cdp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Filiaal%2Fedge-cdp/lists"}