Repository navigation
Let found elements act on themselves - #18
Merged
Merged
Conversation
find_element and interactive_elements now return Element objects: still
the dicts the browser sent, with every tool that takes a backendNodeId as
a method aimed at that node, so
found = page.find_element(role="button", name="Accept")
found[0].click()
replaces page.click(backend_node_id=found[0]["backendNodeId"]). The
methods are generated like the session's, into ElementMethods and
AsyncElementMethods, without the selector, url and timeout parameters
that would aim them elsewhere.
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.
find_elementandinteractive_elementsnow returnElements (AsyncElementfrom anAsyncSession). Each is still the dict the browser sent, sofound[0]["name"]andfound[0]["backendNodeId"]keep working, and every tool that takes abackendNodeIdis also a method on it:The element methods are generated like the session's, into
ElementMethods/AsyncElementMethods:click,fill,hover,press,scroll,select_option,set_checked,markdown,html,tree,screenshot,node_details. They drop theselector,urlandtimeoutparameters, which would aim the call elsewhere or navigate first. The generator refuses a tool that would shadow adictmethod.The first commit only regenerates
_methods.pyagainst today's nightly, which had drifted (extractdocs,tree'smax_bytes).Also works against the 1.0.0 binary, so it can ship as 1.0.0.post2.