Repository navigation
fix: encode element handle selectors so nested and special-character queries work - #6
Conversation
…queries work Co-authored-by: Artiom Lunev <artiom@browserless.io>
|
All 13 current-head checks pass, including Python 3.11–3.14, lint/type checks, wheel, workflow lint, public-content validation and CodeQL. CodeRabbit completed with no actionable comments; there are no unresolved review threads and no merge conflict. No review fixes were needed. This remains a draft: the development-service live regression run is still outstanding because no verified development credential is available. Local Chromium interpolation checks do not replace that live acceptance. No production tests were run. |
Review: ready once the description is updated and the PR is marked readyThe encoding is correct. Against Live acceptance on dev, which the PR still lists as outstanding:
Lint, mypy and the offline suite pass on 3.11 and 3.14 (211 passed, 1 skipped), and codegen leaves no diff. Important
Minor
|
Co-authored-by: Artiom Lunev <artiom@browserless.io>
|
Added the explanation that JSON escapes lone UTF-16 surrogates before URI encoding. The existing safety test already asserts on the raw URI-encoded payload: json.loads removes only the enclosing JavaScript string literal; unquote happens after both safety assertions, solely for the round-trip check. No assertion change is needed. Updated the description to attribute the reported dev acceptance to the reviewer and preserve the integration requirements with #8. Main currently has no overlapping SDK changes, so there is no conflict to rebase or live-test skip count to recount yet. Fresh local verification: 211 offline tests pass, 1 skipped; formatting, lint, mypy, codegen drift and schema checks pass. The only pushed source change is a comment; runtime behavior and the reviewed live regression are unchanged. Readiness will follow the new head CI/review checks. |
|
Review follow-up is complete. The description now records the reviewer-reported dev acceptance, the lone-surrogate explanation is added, and the existing raw-URI safety assertion is retained with the rationale above. All 13 current-head checks pass, including Python 3.11–3.14, lint, wheel, public rules/title, workflow lint and CodeQL. CodeRabbit reports no actionable comments; no review threads or merge conflict remain. Marked ready for review. Integration with #8 still requires preserving encoding, scoped options and html forwarding together, regenerating outputs and recounting the live-suite skip expectation when the second PR lands. |
Gikoskos
left a comment
There was a problem hiding this comment.
Approved: the review findings are addressed, and live acceptance on dev passed.
🤖 I have created a release *beep* *boop* --- ## [0.3.0](v0.2.0...v0.3.0) (2026-11-13) ### ⚠ BREAKING CHANGES * `Page.query_selector()` and `Page.query_selector_all()` no longer fetch `innerHTML`/`outerHTML`; pass `html=True`. Reading `ElementHandle.inner_html` or `outer_html` on a handle queried without it raises `BAPValueError`. `Page.response()` no longer returns `body`; pass `body=True` (or `body_encoding=True`, which implies it). the exceptions `TimeoutError`, `ConnectionError` and `ValueError` are removed from `browserless_bap` and `browserless_bap.errors`; use `BAPTimeoutError`, `BAPConnectionError` and `BAPValueError` (they still subclass the matching built-in exceptions). `browserless_bap.graphql.RESPONSE_FIELDS` no longer has the `HTTPResponseWithRemoteMetadata` and `ResponseResponseWithBodyEncoding` keys; use `OPTIONAL_FIELDS` with `selection_for()`. `QuerySelectorResponse["childElementCount"]` is typed `int` (was `float`), and `browserless_bap.sync_api.Browserless.connect(transport=...)` is typed `TransportFactory | None` (was `Any`). * Opening a page now times out after `connect_timeout` (default: the `timeout` value, 30000 ms). Pass `connect_timeout=0` to restore the previous unbounded wait. ### Features * bound connection time and harden the transport ([#9](#9)) ([1689f3b](1689f3b)) * make element HTML and response bodies opt-in and rename builtin-shadowing errors ([#8](#8)) ([bc80671](bc80671)) ### Bug Fixes * encode element handle selectors so nested and special-character queries work ([#6](#6)) ([f22f12b](f22f12b)) * sync API listener delivery, wait_for_function predicates and parity checks ([#7](#7)) ([e5a106d](e5a106d)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: browserless-actions-bot[bot] <186328842+browserless-actions-bot[bot]@users.noreply.github.com>
Summary
timeoutandvisiblefrom scoped queries in both async and sync APIs.query_selector_allresult, with regenerated Page code.Related issues
None.
Type of change
Checklist
ruff format --check .ruff check .mypypytest -m "not e2e"— 211 passed, 1 skipped, 5 deselected on Python 3.13python scripts/codegen.pyleaves no difftype: summary)Notes for reviewers
Live dev acceptance reported by the reviewer: review and results. The reviewer ran
pytest -m e2e: 5/5 pass, including the new nested/special-character regression, which fails on main with"undefined" is not valid JSON. A 22-case async probe matches the TypeScript SDK throughout (main fails 11), and a sync run with the new options passes. These are reviewer-run results, not a claim that the author reran the dev suite. No production tests were run by this PR's author.Offline checks also pass for the schema lock, package build,
twine check, and fresh-wheel async/sync imports. A local Chromium probe simulating quote-only string interpolation failed all 17 nested/special-character cases on the original encoding and passed all 17 on this branch. That probe does not replace live-service acceptance.Integration with #8: whichever PR lands second must preserve the encoded selectors, scoped
timeout/visibleoptions andhtml=forwarding in both async and sync APIs, regenerate generated files, retain forwarding tests and recount the live-suite skip expectation. Neither PR is imported into the other here.ElementHandle.selectoris an opaque expression: its text changes for scoped and indexed handles. Page-level selectors remain unchanged. Page-wide backslash/newline limitations and an HTML opt-in are not changed here. No runtime dependency, version or changelog changes.Summary by CodeRabbit
Nonefor a single result or an empty list for multiple results.