#4143 Issue fix and test cases as well#4145
Open
hemant838 wants to merge 1 commit intobrowser-use:mainfrom
Open
#4143 Issue fix and test cases as well#4145hemant838 wants to merge 1 commit intobrowser-use:mainfrom
hemant838 wants to merge 1 commit intobrowser-use:mainfrom
Conversation
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.
The Bug
The input action focuses elements using DOM.focus() — a CDP API that programmatically moves focus without firing mouse events. This is fine for normal text inputs, but many real-world
autocomplete/combobox widgets (Select2, MUI Autocomplete, Ant Design, etc.) bind their dropdown-open logic to mousedown/click events, not the focus event.
So when the agent does input(index=5, text="New York") on an autocomplete field:
When you manually do click then type, it works because click dispatches real mouse events (mousePressed → mouseReleased) which the widget's JS listens for.
What I changed
Modified _focus_element_simple() (the method that focuses an element before typing) to detect autocomplete fields and use click-to-focus instead of DOM.focus() for them:
Added a test with an HTML page where the combobox dropdown only opens on mousedown/click exactly the scenario that was broken. The test verifies that tools.input() triggers the dropdown to open.
What I didn't change
Summary by cubic
Fix input on autocomplete/combobox fields by preferring click-to-focus so mouse events fire and dropdowns open. This makes tools.input reliably show suggestions in common widgets.
Written for commit 2210203. Summary will update on new commits.