Conversation
Co-authored-by: P4X-ng <223870169+P4X-ng@users.noreply.github.com>
Co-authored-by: P4X-ng <223870169+P4X-ng@users.noreply.github.com>
…mple Co-authored-by: P4X-ng <223870169+P4X-ng@users.noreply.github.com>
Co-authored-by: P4X-ng <223870169+P4X-ng@users.noreply.github.com>
Co-authored-by: P4X-ng <223870169+P4X-ng@users.noreply.github.com>
Co-authored-by: P4X-ng <223870169+P4X-ng@users.noreply.github.com>
Co-authored-by: P4X-ng <223870169+P4X-ng@users.noreply.github.com>
…content to get_outer_html Co-authored-by: P4X-ng <223870169+P4X-ng@users.noreply.github.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4d7b165f64
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| ''' | ||
| http_url = f'http://{host}:{port}/json/version' | ||
| try: | ||
| with urllib.request.urlopen(http_url) as response: |
There was a problem hiding this comment.
Avoid blocking URL discovery in async path
The HTTP discovery uses a synchronous urllib.request.urlopen call, and open_cdp() invokes this when given an HTTP URL. In a Trio application, a slow or unreachable Chrome endpoint will block the entire event loop here, stalling unrelated tasks and timeouts. Consider running the discovery in a worker thread (e.g., trio.to_thread.run_sync) or using an async HTTP client with a timeout so open_cdp() stays non-blocking.
Useful? React with 👍 / 👎.
| targets = await target.get_targets() | ||
|
|
||
| for t in targets: | ||
| if (t.type == 'page' and |
There was a problem hiding this comment.
New examples use wrong attribute t.type instead of t.type_
High Severity
The new example files use t.type to check target type, but this was explicitly fixed in PR #21 to use t.type_ due to an AttributeError in the updated chrome-devtools-protocol 0.4.0 bindings. The existing examples (get_title.py and screenshot.py) were correctly updated, but five new examples (form_interaction.py, get_title_http.py, get_title_programmatic.py, keyboard_mouse.py, network_events.py) still use the old incorrect attribute name. This will cause an AttributeError when running these examples.
🔬 Verification Test
Why verification test was not possible: This bug is in example scripts that require a running Chrome browser with remote debugging enabled. The bug is confirmed by comparing the diff: lines 36-37 in get_title.py show the fix from t.type to t.type_, while the new examples at the specified lines all use t.type. The PR description explicitly states "PR #21: Fixed AttributeError in examples - t.type → t.type_" confirming the correct attribute is type_.
Consolidates 6 open PRs into master, resolving conflicts and maintaining compatibility with recently merged PR #27.
Changes
Bug Fixes
t.type→t.type_Dependencies & Code Generation
New Features
PR Add programmatic Chrome WebSocket URL discovery #26: Chrome WebSocket URL discovery - accepts HTTP URLs and auto-resolves via
/json/versionendpointPR [WIP] Extend more abstract functions and classes using API #24: High-level automation utilities (Puppeteer-inspired, pure CDP)
Documentation
Implementation Notes
Merge strategy used manual cherry-picking to preserve PR #27's session detachment logic. Test fixtures updated to handle
detach_from_targetcommands. Utility test timeouts remain (mock server lifecycle issues, doesn't affect library functionality).Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.
Note
Adds user-facing utilities and connection improvements, plus major dependency updates and docs/examples.
trio_cdp.utilwithKeyboard,Mouse,ElementHandle, and selector helpers (query_selector,wait_for_selector)find_chrome_debugger_url();open_cdp()auto-resolves/json/versionwait_for()/listen()), new utilities page; updates READMEtrio0.22+,trio_websocket0.9+,chrome-devtools-protocol0.4.0; regenerates bindings and refreshes lockfiletyping.Optional/Dict/Generatort.type_; adds tests for URL discovery and ensures listeners exit on connection/session close; adjusts fixtures fordetachFromTargetWritten by Cursor Bugbot for commit 4d7b165. Configure here.