Commit Graph

8243 Commits

Author SHA1 Message Date
Laith Weinberger 0f735d211f make mou input work
after each action, check if new stuff appeared. If yes, stop and let the agent see the dropdown before blindly clicking search
2026-01-30 19:07:00 -05:00
laithrw d17f5e9e71 fix(#3889): Draft.js editors lose first character when typing (#3952)
Continuation of
[#3896](https://github.com/browser-use/browser-use/pull/3896) by
@Jacky040124 - condensed comments to match codebase style. Resolves
#3889.

<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Fixes Draft.js editors dropping the first typed character. Detects
Draft.js (class includes DraftEditor or
data-contents/data-block/data-offset-key) and prepends a sacrificial
space only when the input is cleared first, so the space is consumed and
the intended text is preserved.

<sup>Written for commit c62ceafa25.
Summary will update on new commits.</sup>

<!-- End of auto-generated description by cubic. -->
2026-01-26 19:53:00 -05:00
laithrw c62ceafa25 Merge branch 'main' into fix/3889-draftjs-first-char 2026-01-26 19:51:08 -05:00
Laith Weinberger ca049c67a1 clean comments 2026-01-26 19:28:45 -05:00
Saurav Panda bd0c9f306e set default gemini thinking to auto (#3950)
<!-- This is an auto-generated description by cubic. -->
## Summary by cubic
Set Gemini thinking to auto by default. Align thinking config per model
(Gemini 3 Pro, 3 Flash, 2.5) for better defaults and fewer
misconfigurations.

- **Refactors**
- Gemini 3 Pro: uses thinking_level only, defaults to low; warns on
thinking_budget and on minimal/medium.
- Gemini 3 Flash: supports both; uses thinking_level if set, else
thinking_budget = -1.
- Gemini 2.5: uses thinking_budget only, default -1; warns if
thinking_level is set.
  - Example: simplified ChatBrowserUse usage by removing explicit model.

<sup>Written for commit ee35b53b12.
Summary will update on new commits.</sup>

<!-- End of auto-generated description by cubic. -->
2026-01-26 12:49:13 -08:00
Saurav Panda ee35b53b12 Merge branch 'main' into saurav/change-gemini-thinking-to-auto 2026-01-26 12:46:52 -08:00
Saurav Panda 6d54f521cf set default gemini thinking to auto 2026-01-26 12:44:51 -08:00
laithrw d58f40b811 issue 3694 fixed: handling aria combobox options dropdown (#3698)
## Summary

* Fixes `dropdown_options` failing on ARIA combobox elements with
dynamically rendered options.
* Adds proper handling for `aria-controls`-linked listboxes and expands
collapsed comboboxes before extraction.

## Changes

### Updated handler in `default_action_watchdog.py`:
* Detects `role="combobox"` with `aria-controls`.
* Expands the combobox via dispatched focus/click events.
* Waits briefly for dynamic options to render.
* Resolves the listbox by `aria-controls` and extracts
`[role="option"]`.
* Returns structured results consistent with existing dropdown output.

Addresses issue #3694 

<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Fixes dropdown option extraction for ARIA comboboxes with dynamic menus
by expanding the control and reading options from its aria-controls
listbox. Resolves #3694 and restores reliable dropdown_options behavior
for ARIA patterns.

- **Bug Fixes**
- Detect role="combobox" with aria-controls and use a dedicated handler.
- Expand collapsed comboboxes (focus/click/mousedown) and wait for
dynamic options.
- Read options from the controlled listbox ([role="option"], with li
fallback), return consistent output, then collapse.
- Keep generic dropdown logic scoped to menu/listbox (combobox handled
separately).
- Clear error messages and logging when listbox or options are missing.

<sup>Written for commit 7cf8575e4a.
Summary will update on new commits.</sup>

<!-- End of auto-generated description by cubic. -->
2026-01-26 15:27:14 -05:00
laithrw 7cf8575e4a Merge branch 'main' into main 2026-01-26 15:24:11 -05:00
laithrw d8feccdf09 fix(#3538): always index scrollable dropdown containers (#3945)
<!-- This is an auto-generated description by cubic. -->
## Summary by cubic
Always index scrollable dropdown containers so they can be targeted by
select_dropdown, even when they contain interactive descendants.
Addresses #3538.

- **Bug Fixes**
- Detect dropdowns by role (listbox, menu, combobox, menubar, tree,
grid), tag (select), or common classes (dropdown, dropdown-menu,
select-menu, Semantic UI “ui dropdown”).
- Leave other scrollable elements unchanged: only indexed when they have
no interactive descendants.

<sup>Written for commit 7bacbbbfa2.
Summary will update on new commits.</sup>

<!-- End of auto-generated description by cubic. -->
2026-01-26 15:18:46 -05:00
laithrw 7bacbbbfa2 Merge branch 'main' into 3538 2026-01-26 15:15:27 -05:00
laithrw 004756da5a fix(#2867): verify dropdown selection and retry on framework revert (#3944)
Resolves #2867.

The select_dropdown action was claiming success even when frameworks
like Wix intercepted and reverted the programmatic selection. The agent
would report task completion, but the dropdown value remained unchanged.

- Added verification after setting selection - checks if `element.value
=== expectedValue`
- If framework reverted the value, try click-based fallback (mousedown
-> selectedIndex -> click option -> mouseup -> change)
- If both methods fail, properly report the error instead of claiming
success
- Agent can then recover by clicking visible option elements directly

Only affects native `<select>` elements in
`on_SelectDropdownOptionEvent`. ARIA/custom dropdowns already use
click-based selection.

<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Fixes dropdown selection reliability by verifying the final value and
retrying with a click-based fallback when frameworks revert programmatic
changes. Aligns with #2867 so the agent no longer claims success when
the value doesn’t stick.

- **Bug Fixes**
  - Verify selection after setting (element.value === expectedValue).
- If reverted, use click-based fallback (focus, mousedown, set
selectedIndex, click option, mouseup, change, blur).
  - If both methods fail, return a clear error so the agent can recover.
- Provide target option and available options when a revert is detected
to aid recovery.
- Scope: affects native <select> in on_SelectDropdownOptionEvent;
ARIA/custom dropdowns unchanged.

<sup>Written for commit 6f8c077932.
Summary will update on new commits.</sup>

<!-- End of auto-generated description by cubic. -->
2026-01-26 15:14:18 -05:00
zhongzhenyu b1fad345d6 style: remove trailing whitespace 2026-01-25 22:05:01 -08:00
zhongzhenyu f13d8246e9 fix: Fix Draft.js space prepending to only apply when clear=True 2026-01-25 21:58:18 -08:00
Laith Weinberger e1c4eeef35 fix(#3538): always index scrollable dropdown containers regardless of interactive descendants 2026-01-25 17:05:10 -05:00
Laith Weinberger 6f8c077932 lint 2026-01-25 15:49:49 -05:00
Laith Weinberger 64ada81915 fix(#2867): verify dropdown selection and retry if reverted
addresses select_dropdown silently claiming success even when frameworks intercepted and reverted the selection
2026-01-25 15:40:22 -05:00
Saurav Panda 8b5b7a715b removed duplicate --headed flag from skill cli (#3943)
<!-- This is an auto-generated description by cubic. -->
## Summary by cubic
Removed the duplicate --headed flag from the open subcommand so the
global --headed option is respected. Fixes the parsing bug tracked in
issue #3931.

- **Bug Fixes**
- Removed the open subcommand’s --headed arg that was shadowing the
global flag.
- Added tests to verify --headed works before subcommands, with
--session and --browser, and defaults to False.

<sup>Written for commit acd05e30e0.
Summary will update on new commits.</sup>

<!-- End of auto-generated description by cubic. -->
2026-01-25 12:00:41 -08:00
Saurav Panda acd05e30e0 removed duplicate --headed flag from skill cli 2026-01-25 11:34:09 -08:00
laithrw d1a53a158e Merge branch 'main' into main 2026-01-25 12:31:43 -05:00
laithrw 639d4829a5 fix(#3292): make table rows and cells with role='row'/'cell' interactive (#3870)
fixes: #3292
This pull request fixes an issue where table rows (<tr>) and table cells
(<td>) were not being recognized as interactive elements by the
ClickableElementDetector, even when they explicitly defined appropriate
ARIA roles such as role="row" or role="gridcell". Because of this
limitation, the agent was unable to click on interactive rows and cells
in many real-world table and data-grid implementations.
To address this, changes were made in
browser_use/dom/serializer/clickable_elements.py. The roles row, cell,
and gridcell were added to the interactive_roles set, which checks roles
defined via HTML attributes, and also to the interactive_ax_roles set,
which checks roles derived from the Accessibility Tree. This ensures
that both DOM-level role definitions and accessibility-level roles are
consistently treated as interactive when appropriate.
The motivation for this change comes directly from user reports in issue
#3292, where interactive table rows in data grids and tables could not
be clicked by the agent. The previous logic only allowed a narrow set of
roles (such as buttons or links), incorrectly filtering out rows and
cells despite their widespread use as interactive components in modern
web applications.
The fix was verified in two ways. First, an isolated test script was
created to confirm that ClickableElementDetector.is_interactive()
correctly returns True for mocked EnhancedDOMTreeNode objects with roles
set to row and gridcell. Second, full regression testing was performed
by running the entire tests/ci/browser/test_dom_serializer.py test
suite. All tests passed successfully, confirming that the added roles do
not break existing DOM serialization behavior or introduce unintended
interactive elements.

<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Fixes #3292 by treating table rows and cells with ARIA roles as
interactive so the agent can click them in data grids and tables.

- **Bug Fixes**
- Added 'row', 'cell', and 'gridcell' to interactive_roles and
interactive_ax_roles in clickable_elements.py.
- Verified with an isolated test and the dom serializer test suite; no
regressions.

<sup>Written for commit 468d149588.
Summary will update on new commits.</sup>

<!-- End of auto-generated description by cubic. -->
2026-01-25 10:50:33 -05:00
laithrw 468d149588 Merge branch 'main' into fix/3292-table-row-clickability 2026-01-25 10:48:47 -05:00
laithrw e2c24e2967 fix: detect label/span wrappers for AntD-style controls (#3854)
Fixes #3742.

- detect labels without `for` that wrap form controls (up to 2 levels,
e.g. label > span > input)
- skip labels with `for` to avoid double activation
- allow span wrappers that contain form controls
- add AntD-like radios to DOM serializer test page and assert
detection/clicks

Tests:
- uv run pytest tests/ci/browser/test_dom_serializer.py -q

<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Detects AntD-style label/span wrappers around form controls so the DOM
serializer treats them as interactive and clicks them correctly, while
avoiding double activation on labels with a “for” attribute.

- **Bug Fixes**
- Detect labels without “for” that wrap inputs within 2 levels (label >
span > input).
  - Skip labels with “for” to prevent double-clicking external inputs.
  - Treat span wrappers with nested form controls as interactive.

<sup>Written for commit 794b68b448.
Summary will update on new commits.</sup>

<!-- End of auto-generated description by cubic. -->
2026-01-25 10:45:30 -05:00
laithrw 794b68b448 Merge branch 'main' into fix/label-span-interactive-antd 2026-01-25 10:43:27 -05:00
Laith Weinberger d646f2fbc0 revert tests/ci/browser 2026-01-25 10:41:48 -05:00
laithrw aa58d7222e detect JS event listeners for clickable elements (resolves #958) (#3933)
Uses CDP Runtime.evaluate with includeCommandLineAPI to access
getEventListeners() and mark elements with click/mousedown/pointerdown
listeners before DOM snapshot capture. Fixes #958.

<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Detects JavaScript click/mouse listeners via CDP and treats those
elements as clickable during the DOM snapshot. Resolves #958 and
captures React/Vue/Angular click handlers without mutating the page.

- **New Features**
- Use Runtime.evaluate (includeCommandLineAPI) with getEventListeners()
to collect element refs, resolve to backend node IDs, and flag nodes as
has_js_click_listener.
- Update clickable element serializer to treat flagged nodes as
interactive.

<sup>Written for commit 1794849886.
Summary will update on new commits.</sup>

<!-- End of auto-generated description by cubic. -->
2026-01-25 10:38:31 -05:00
Laith Weinberger 0b8aa55d54 Merge branch 'main' into fix/label-span-interactive-antd 2026-01-24 17:19:38 -05:00
Laith Weinberger 1794849886 don't mutate page
instead of writing markers to DOM, collect element references in JS, resolve them to internal Chrome node IDs via CDP, and store those IDs in Python
2026-01-24 16:36:14 -05:00
Laith Weinberger 20f51c7fef detect JS event listeners for clickable elements
uses CDP Runtime.evaluate with includeCommandLineAPI to access getEventListeners() and mark elements with click/mousedown/pointerdown listeners before DOM snapshot capture
2026-01-24 14:44:08 -05:00
Magnus Müller 527fc93a03 4096-token prompts for Opus/Haiku 4.5 (#3924)
Use separate system prompts for Opus 4.5 and Haiku 4.5 that are at least
4096 tokens (which is the token minimum for both models' input caching),
enabling input caching and notably reducing cost.

<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Enable input caching for Claude Opus 4.5 and Haiku 4.5 by switching to
dedicated 4096+ token system prompts. This lowers cost and improves
performance for these models.

- **New Features**
- Detect Opus/Haiku 4.5 variants and load long system prompts (standard,
flash, no-thinking).
- Add 4096+ token templates: system_prompt_anthropic.md,
system_prompt_anthropic_flash.md,
system_prompt_anthropic_no_thinking.md.
  - Pass model_name to SystemPrompt to drive correct template selection.

<sup>Written for commit f85bbb49c8.
Summary will update on new commits.</sup>

<!-- End of auto-generated description by cubic. -->
2026-01-23 18:10:17 -08:00
Magnus Müller 6b23672c3c Merge branch 'main' into cache-anthropic 2026-01-23 18:10:11 -08:00
Magnus Müller 116eb349cb increase char limit for extraction (#3923)
Resolves [#3557](https://github.com/browser-use/browser-use/issues/3557)
and similar issues. extract_clean_markdown() does extract DOM elements
not visible; its extraction was just being overly truncated.

<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Increased the extraction character limit from 30,000 to 100,000 to
prevent valid content from being cut off during markdown extraction.
Resolves #3557 by allowing full page content (including non-visible DOM
elements) to be returned without premature truncation.

<sup>Written for commit 80a08a4a03.
Summary will update on new commits.</sup>

<!-- End of auto-generated description by cubic. -->

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Increase extraction capacity**
> 
> - Bumps `MAX_CHAR_LIMIT` in `extract()` (in
`browser_use/tools/service.py`) from `30000` to `100000` to allow larger
page content to be processed without truncation.
> 
> *Effect:* fewer cut-offs when extracting long pages; may increase
processing time/token usage.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
80a08a4a03. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
2026-01-23 18:07:18 -08:00
Magnus Müller 80a08a4a03 Merge branch 'main' into #3557 2026-01-23 18:06:47 -08:00
Magnus Müller d9dec964be Merge branch 'main' into fix/3889-draftjs-first-char 2026-01-23 16:24:34 -08:00
Saurav Panda 55580b73ac feat: added thinking level for gemini 3 pro (#3925)
<!-- This is an auto-generated description by cubic. -->
## Summary by cubic
Adds thinking_level support for Gemini 3 (Pro and Flash) with safe
defaults and warnings to prevent misconfiguration.

- **New Features**
- Adds thinking_level for Gemini 3; Pro supports low/high (default low),
Flash supports minimal/low/medium/high (default minimal).
- Uses thinking_level for Gemini 3 and thinking_budget for Gemini
2.5/flash.
- Warns on unsupported configs (budget on 3, level on 2.5); falls back
to low if minimal/medium set on 3 Pro.
- Sets thinking_budget=0 by default for Gemini 2.5/flash when not
provided.

- **Migration**
- For Gemini 3, use thinking_level (Pro: low/high; Flash:
minimal/low/medium/high); stop using thinking_budget.
- For Gemini 2.5/flash, use thinking_budget (0 disable, -1 dynamic, or
token count).

<sup>Written for commit b63ae37008.
Summary will update on new commits.</sup>

<!-- End of auto-generated description by cubic. -->
2026-01-23 15:23:03 -08:00
Saurav Panda b63ae37008 Merge branch 'main' into gemini-add-thinking-level 2026-01-23 15:21:17 -08:00
Saurav Panda a97fa345f8 feat(cli): add ChatBrowserUse support for BROWSER_USE_API_KEY (#3914)
## Summary
- Add `ChatBrowserUse` as the first LLM option in the CLI `run` command
when `BROWSER_USE_API_KEY` is set
- Update error message to mention `BROWSER_USE_API_KEY` as a valid
option

## Problem
The CLI `run` command currently only checks for `OPENAI_API_KEY`,
`ANTHROPIC_API_KEY`, or `GOOGLE_API_KEY`, but the
[documentation](https://docs.browser-use.com/supported-models) shows
that `ChatBrowserUse` with `BROWSER_USE_API_KEY` is a valid and
recommended LLM option for browser automation.

Users who only have `BROWSER_USE_API_KEY` configured get the error:
```
No LLM configured. Set OPENAI_API_KEY, ANTHROPIC_API_KEY, or GOOGLE_API_KEY
```

## Solution
Added `ChatBrowserUse` support in `get_llm()` function, checking
`BROWSER_USE_API_KEY` first since it's the optimized model for
browser-use tasks.

## Testing
Tested locally - `browser-use run "go to google.com"` now works with
only `BROWSER_USE_API_KEY` set.

<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Adds ChatBrowserUse support to the CLI run command by preferring
BROWSER_USE_API_KEY in get_llm, enabling runs with only that key.
Updates the “No LLM configured” error to include BROWSER_USE_API_KEY.

<sup>Written for commit 2774be5cc6.
Summary will update on new commits.</sup>

<!-- End of auto-generated description by cubic. -->
2026-01-23 15:21:05 -08:00
Saurav Panda 2774be5cc6 Merge branch 'main' into fix/cli-chatbrowseruse-support 2026-01-23 15:18:19 -08:00
Saurav Panda ac4d958183 Merge branch 'main' into gemini-add-thinking-level 2026-01-23 15:16:18 -08:00
Saurav Panda 89fec05871 revert the example.py 2026-01-23 15:13:52 -08:00
Saurav Panda bb3b1e8cf5 added minimal model for gemini 3 flash 2026-01-23 15:11:13 -08:00
Saurav Panda 041d03a93f feat: updated the thinking budget 2026-01-23 14:42:59 -08:00
Saurav Panda 1671170bf6 set default thinking to 0 for gemini-3 models (#3922)
<!-- This is an auto-generated description by cubic. -->
## Summary by cubic
Set the default thinking_budget to 0 for Gemini 3 models when not
specified, matching the existing behavior for flash/flash-lite. This
prevents unexpected thinking token usage and keeps responses fast.

<sup>Written for commit 5b06f4edd9.
Summary will update on new commits.</sup>

<!-- End of auto-generated description by cubic. -->
2026-01-23 13:47:22 -08:00
Saurav Panda 5b06f4edd9 set default thinking to 0 for gemini-3 models 2026-01-23 13:44:29 -08:00
Laith Weinberger a75fa14d14 increase char limit for extraction 2026-01-23 16:38:38 -05:00
Saurav Panda 18c33bbdc6 Added browser use 2-0 support (#3921)
<!-- This is an auto-generated description by cubic. -->
## Summary by cubic
Add support for the bu-2-0 Browser Use model so agents can use the
latest LLM.

- **New Features**
  - Allow bu-2-0 in ChatBrowserUse model validation (replaces bu-1-5).
  - Update examples/simple.py to use bu-2-0.

- **Migration**
  - If you used bu-1-5, switch to bu-2-0.

<sup>Written for commit f3aad3c145.
Summary will update on new commits.</sup>

<!-- End of auto-generated description by cubic. -->
2026-01-23 13:37:37 -08:00
Laith Weinberger f85bbb49c8 pass model_name to SystemPrompt 2026-01-23 16:33:28 -05:00
Laith Weinberger 2f24f53900 use longer prompts for opus/haiku 4.5 to allow caching 2026-01-23 16:20:25 -05:00
Saurav Panda f3aad3c145 Added browser use 2-0 support 2026-01-23 13:17:56 -08:00
Saurav Panda 9ce7135073 Added support for new browser use model (#3920)
<!-- This is an auto-generated description by cubic. -->
## Summary by cubic
Adds support for the new bu-1-5 model in ChatBrowserUse and updates the
simple example to use it. Existing models (bu-latest, bu-1-0) and the
browser-use/* pattern remain supported.

<sup>Written for commit 37586c9e9f.
Summary will update on new commits.</sup>

<!-- End of auto-generated description by cubic. -->
2026-01-23 12:42:39 -08:00