-
Notifications
You must be signed in to change notification settings - Fork 17
Merge all open pull requests #28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Co-authored-by: P4X-ng <[email protected]>
Co-authored-by: P4X-ng <[email protected]>
…mple Co-authored-by: P4X-ng <[email protected]>
Co-authored-by: P4X-ng <[email protected]>
Co-authored-by: P4X-ng <[email protected]>
Co-authored-by: P4X-ng <[email protected]>
Co-authored-by: P4X-ng <[email protected]>
…content to get_outer_html Co-authored-by: P4X-ng <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.