Let callers read a navigation's status off the result - #12
Merged
Merged
Conversation
Catches up with browser changes already on main: detectForms and interactiveElements now document their JSON shape, evaluate documents its script argument, scroll takes a selector, and goto reports the HTTP status (lightpanda-io/browser#3691).
`goto` used to answer "Navigated successfully." whatever came back, so a 404 was indistinguishable from content. lightpanda-io/browser#3691 put the status in that sentence and #3694 sends the same facts as MCP `structuredContent`, which is where this reads them. `goto` and the actions now return a `PageResult`: the sentence, with `url`, `http_status` and `title` as attributes. A str subclass rather than a dict because the sentence carries what the fields don't -- which element was clicked, whether a new window took over -- and returning either alone would lose something. Older binaries send no `structuredContent` and still fall through to the plain string, so this is safe ahead of the browser release that carries #3694; the new test skips against them.
arrufat
force-pushed
the
page-result-status
branch
from
September 30, 2026 09:24
f94943e to
fd13ba3
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Until now
page.goto(...)answeredNavigated successfully.whatever came back, so a 404 was indistinguishable from the page you wanted. lightpanda-io/browser#3691 put the status into that sentence, and lightpanda-io/browser#3694 sends the same facts as MCPstructuredContent. This reads them.Why a str subclass and not a dict
Returning the parsed object would match what
extractandlinksalready do, and it was my first instinct. But the sentence carries things the fields don't — which element was clicked, andOpened a new window; tools now act on it.when a click took over a popup. Returning either one alone drops something, soPageResultis the sentence, with the fields as attributes. Printing it, comparing it andstartswithare all unchanged.That mirrors the reasoning on the browser side for leaving
evaluateout ofstructuredContent: don't throw away the payload for the metadata.Ordering
CI builds against browser
nightly, which does not carry #3694 yet. A binary that sends nostructuredContentfalls through to the plain string exactly as before, and the new test skips rather than fails — so this is safe to merge first and starts exercising itself once #3694 lands.The two commits
Regenerate _methods.pyis pre-existing drift, not caused by this change:detectFormsandinteractiveElementsnow document their JSON shape,evaluatedocuments itsscriptargument,scrollgained aselector, andgoto's description changed in #3691. CI fails on that drift against nightly regardless. It is first on the branch so it can be split off if you would rather land it on its own — I checked that the generated file is byte-identical whether produced from a binary with or without #3694, so the newoutputSchemadoes not reach_methods.py.