Fix interaction bugs: scroll_down AttributeError and fill stale object_id#35
Fix interaction bugs: scroll_down AttributeError and fill stale object_id#35ToufiqQureshi wants to merge 3 commits intomainfrom
Conversation
- Modified Connection.target_id to return cdp.target.TargetID object instead of str, fixing AttributeError in get_window_for_target(). - Implemented retry mechanism in Element.apply() to handle CDP Error -32000 (Could not find object with given id) by clearing cached remote_object and calling update() before retrying. - Added unit tests to verify both fixes. Co-authored-by: ToufiqQureshi <139612256+ToufiqQureshi@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
- Modified Connection.target_id to return cdp.target.TargetID instead of str, fixing AttributeError in cdp.browser calls. - Implemented robust retry in Element.apply() for CDP Error -32000, including cache clearing and state refresh via update(). - Refactored Element.click() (fast/cdp modes) to use apply(), ensuring operations like fill() are resilient to React re-renders. - Added safety checks for CDP responses in apply() to prevent TypeErrors. - Verified with unit tests covering retry logic and ID type consistency. Co-authored-by: ToufiqQureshi <139612256+ToufiqQureshi@users.noreply.github.com>
- Preserved fix for Connection.target_id returning cdp.target.TargetID to resolve AttributeError in cdp.browser calls. - Implemented optional retry logic for CDP Error -32000 in apply(), get_position(), send_file(), and flash(), defaulting to False. - Refactored click() to use apply() for centralized resilience when retry is enabled. - Removed automatic click() from Element.fill() to ensure explicit user control. - Removed automatic flash() from ActionsMixin methods and made it optional in Element.click(). - Added comprehensive unit tests for retry logic, type consistency, and manual control validation. Co-authored-by: ToufiqQureshi <139612256+ToufiqQureshi@users.noreply.github.com>
This PR fixes two interaction bugs reported during testing on NEUROFIQ:
AttributeError in
tab.scroll_down():The
get_window_for_targetCDP method expects acdp.target.TargetIDobject (which has a.to_json()method), but it was receiving a plainstrfromConnection.target_id. I've updatedConnection.target_idto return the original CDP object.CDP Error -32000 in
fill():JS-based interactions like
fill()(which usesapply()) were failing when React re-rendered elements, causing the CDPobject_idto become stale. I've updatedElementInteractionMixin.apply()to catch this specific error code (-32000), clear the cached_remote_object, refresh the element state usingupdate(), and retry the operation once.Unit tests in
test_fixes_unit.pyconfirm thattarget_idreturns the correct type and thatapply()successfully retries with a refreshed state upon encountering a stale ID.PR created automatically by Jules for task 10398194865324604709 started by @ToufiqQureshi