Skip to content

Bug: click, dropdown_options, and select_dropdown report 'element not found' as success instead of error #5438

Description

@shotsan

Browser Use Version

0.13.7 (commit 3260188)

Bug Description

Three actions in browser_use/tools/service.py return "element not found" as a non-error ActionResult when the element index is missing from the selector map. This is the same class of bug as #5361 (which covers scroll, input, and find_text), but in three additional actions that were not mentioned in that issue.

Affected actions

Action File location Line
_click_by_index tools/service.py ~715-718
dropdown_options tools/service.py ~1679-1682
select_dropdown tools/service.py ~1707-1710

All three have the identical pattern:

node = await browser_session.get_element_by_index(params.index)
if node is None:
    msg = f'Element index {params.index} not available - page may have changed.'
    logger.warning(f'⚠️ {msg}')
    return ActionResult(extracted_content=msg)  # <-- missing error=

Why this matters

  1. Agent.multi_act() checks results[-1].error to decide whether to abort remaining queued actions. With error=None, follow-up actions (e.g. a submit button click after a failed text input) keep executing against a stale or wrong page.

  2. Agent._post_process() increments consecutive_failures only when last_result[-1].error is set. These false successes never count toward max_failures, so the agent never triggers its failure recovery.

  3. The LLM is told the action succeeded via evaluation_previous_goal, so it reasons from a false premise on the next step.

Additional issue in select_dropdown

When selection_data.get('success') != 'true' and the response contains short_term_memory/long_term_memory keys, the function returns a non-error ActionResult (lines ~1733-1737). There is already a # TODO comment noting this should raise BrowserError. The failed selection is reported as a success to the agent.

Steps to Reproduce

  1. Start an agent task that involves clicking an element
  2. Between the DOM snapshot and the click execution, let the page change (element disappears)
  3. The click returns ActionResult(extracted_content="Element index X not available...") with no .error
  4. The agent treats this as success and proceeds with follow-up actions

Expected Behavior

All three actions should return ActionResult(error=msg) when the element is not found, consistent with how scroll handles the same condition at line ~1380.

Proposed Fix

Change ActionResult(extracted_content=msg) to ActionResult(error=msg) in all three locations. For the select_dropdown structured error path, add error= to the ActionResult.

Related

Activity

  1. hansu650 commented on Aug 12, 2026

    @hansu650

    I’m working on this. I’ll update the missing-element paths for click, dropdown_options, and select_dropdown to return ActionResult(error=...), cover the structured select failure path, and add focused regression tests before opening a PR.

  2. hansu650 commented on Aug 13, 2026

    @hansu650

    @yun520-1 Thanks — agreed on the status-inversion framing. The linked PR already makes that invariant explicit in both implementation and coverage: it returns ActionResult(error=...) for missing indexes in click, dropdown_options, and select_dropdown, and the parametrized regression invokes each action separately with an absent selector index, asserting the exact error and extracted_content is None. It also covers the structured select_dropdown failure path so useful options remain available while the action is still marked as an error.

  3. MilkyWay008 commented on Aug 14, 2026

    @MilkyWay008

    For anyone stuck on this before the fix lands: you can patch it yourself in the installed copy, three spots in browser_use/tools/service.py — _click_by_index (~715), dropdown_options (~1679), select_dropdown (~1707) — change ActionResult(extracted_content=msg) to ActionResult(error=msg), plus the structured select path around ~1733. With error= set, _post_process() actually counts the misses toward max_failures so recovery kicks in. hansu650's PR covers it properly, so tracking that beats re-reporting.

  4. jinngimk-lang commented on Aug 17, 2026

    @jinngimk-lang

    This is a perfect AgentCI breaker shape: the browser action objectively did not happen, but the agent loop records success and keeps executing queued effects. That is exactly the kind of false-PASS we want external developers/agents to help us freeze into regression fixtures.

    If you can keep this repro minimal, AgentCI can turn it into a portable case: stale/missing element → action result → downstream queue behavior → terminal verdict. The accepted reproducer gets durable public credit in our Breaker Hall of Fame, a backlink to this issue, and priority conversion help so the bug becomes an executable proof instead of disappearing after the fix.

    AgentCI: https://github.com/jinngimk-lang/agentci
    Challenge/credit rules: https://github.com/jinngimk-lang/agentci/blob/main/COMMUNITY.md

    We’re affiliated with AgentCI and we’re not claiming to certify Browser Use — we’re recruiting real false-success cases like this because they generalize across agent runtimes.

  5. solozerolabs commented on Sep 20, 2026

    @solozerolabs

    Element not found reported as success is the silent no-op case, and it is the one that hurts later.
    Patching each action helps, but a wholesale check catches these no matter which action regresses. Read the page state after the action and confirm something actually changed.
    truefact returns landed / did-not-land / inconclusive from the DOM and network, so a click that found nothing comes back did-not-land.
    https://github.com/solozerolabs/TrueFact

  6. github-actions commented on Nov 19, 2026

    @github-actions

    👋 This issue has been automatically marked as stale because it hasn't had activity for 60 days.

    ⚡ We've made significant progress recently! Please test with the latest version of browser-use to see if this issue has been resolved. If the issue persists, please let us know by commenting below.

    To keep this issue open:

    • Add a comment explaining why this is still relevant after testing the latest version
    • Add the pinned label if this is an important long-term issue
    • Reference it in a PR if you're working on a fix

    This will be automatically closed in 14 days if no further activity occurs.

    Thanks for contributing to browser-use! 🤖 If you have questions, join our Discord.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions