fix: invert fill/press_key priority — native events first, CDP as fallback#5
Open
JADRT22 wants to merge 1 commit into
Open
fix: invert fill/press_key priority — native events first, CDP as fallback#5JADRT22 wants to merge 1 commit into
JADRT22 wants to merge 1 commit into
Conversation
…lback browser_fill and browser_press_key used Chrome Debugger Protocol (CDP) Input.insertText as primary method, which bypasses React/Angular/Vue synthetic event systems. CDP returns ok silently but onChange/onInput listeners never fire on SPA frameworks. Fix: try nativeInputValueSetter + dispatchEvent via safeExecuteScript FIRST (properly triggers framework events), fall back to CDP only when CSP blocks the script execution.
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.
Problem
browser_fillandbrowser_press_keydon't work on React, Angular, or Vue SPAs (GitHub issue forms, AI Studio, Meta Ads). Text appears visually but framework onChange/onInput listeners never fire.Root Cause
background.jsused Chrome Debugger ProtocolInput.insertTextas the primary method. CDP typing bypasses React's synthetic event system — CDP returns ok silently, so the native fallback (nativeInputValueSetter+dispatchEvent) never runs.Fix
Invert the priority: try
safeExecuteScript→nativeInputValueSetterFIRST (dispatches proper input/change events), fall back to CDP only when CSP blocks script execution.Same fix for both CSS-selector and text-selector fill paths, and for
browser_press_key.Verification
After fix,
browser_fillreturns"method": "native"on React SPAs — input events properly dispatched, framework registers the value. CSP-heavy pages (GitHub, Google) still work via CDP fallback.Closes #4