fix: GeckodriverElement W3C serialization for connect-existing mode#58
Open
fix: GeckodriverElement W3C serialization for connect-existing mode#58
Conversation
GeckodriverElement lacked a toJSON() method, causing it to serialize as
{} instead of the W3C element reference format when passed through
JSON.stringify(). This broke hover_by_uid, drag_by_uid_to_uid,
screenshot_by_uid, upload_file_by_uid and evaluate_script in
connect-existing mode.
juliandescottes
approved these changes
Mar 31, 2026
Collaborator
juliandescottes
left a comment
There was a problem hiding this comment.
Thanks for the fix!
I don't know the connect-existing setup well enough, but now that the issue related to BiDi was fixed, do you think we could use a regular driver instance?
In general, it would be great if connecting to an existing instance was using the same setup to avoid bugs and inconsistencies.
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.
Summary
GeckodriverElementserialized as{}when passed throughJSON.stringify(), because it only had private fields and notoJSON()methodtoJSON()returning the W3C element reference format ({"element-6066-11e4-a52e-4f735466cecf": id})executeScript()or the Actions API in--connect-existingmodeAffected tools
hover_by_uidactions().move({ origin: el })serializationdrag_by_uid_to_uidexecuteScript(..., fromEl, toEl)screenshot_by_uidscrollIntoView(arguments[0])upload_file_by_uidexecuteScript(..., el)evaluate_scriptexecuteScript(..., resolvedArgs)Tools using direct HTTP calls (
click_by_uid,fill_by_uid) were not affected.Test plan
findElement,executeScript, andactions().move()Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=2027635