browser-use icon indicating copy to clipboard operation
browser-use copied to clipboard

Dropdown Element Not Detected as Interactive

Open wtberry opened this issue 10 months ago • 7 comments

Bug Description

The isInteractiveElement function in buildDomTree.js fails to recognize a dropdown element as interactive. The function checks interactivity based on attributes such as role, tabindex, and event listeners, but in this case, the interactive part of the dropdown is a child element, while the outer container (which visually represents the dropdown) lacks these attributes. As a result, the dropdown is not flagged as interactive unless a debug override is set.

Reproduction Steps

  1. Use the buildDomTree function to process the DOM, which includes a dropdown component. (Refer to Code Sample section)
  2. Observe that the dropdown's container element is not flagged as interactive.
  3. Modify line 369 to force isInteractive = true.
  4. Run the function again and see that the dropdown, along with its child components, is now detected.

Code Sample

<div class="col-sm-8"><span>
          <div class="Select Select--multi">
              <div class="Select-control"><span class="Select-multi-value-wrapper"
                      id="react-select-2--value">
                      <div class="Select-placeholder">選択してください。</div>
                      <div role="combobox" aria-expanded="false" aria-owns=""
                          aria-activedescendant="react-select-2--value"
                          class="Select-input" tabindex="0" aria-disabled="false"
                          style="border: 0px; width: 1px; display: inline-block;"></div>
                  </span><span class="Select-arrow-zone"><span
                          class="Select-arrow"></span></span></div>
          </div>
          <div class="text-danger"></div>
      </span>
  </div>

Version

0.1.36

LLM Model

GPT-4o

Operating System

macOS Sonoma

Relevant Log Output


wtberry avatar Feb 13 '25 08:02 wtberry

+1 the same problem

bolt163 avatar Feb 14 '25 06:02 bolt163

+1 the same problem

micheal888666 avatar Feb 14 '25 08:02 micheal888666

I have solved the above issue and created a pr, could anyone of you @wtberry @micheal888666 @bolt163 check this and tell if it works now?

anish891 avatar Feb 15 '25 06:02 anish891

I have solved the above issue and created a pr, could anyone of you @wtberry @micheal888666 @bolt163 check this and tell if it works now?

Ok, I'll verify and let you know later.

micheal888666 avatar Feb 15 '25 09:02 micheal888666

Have you verified it? @micheal888666

anish891 avatar Feb 17 '25 18:02 anish891

@anish891 No, the pr is breaking the entire js file with syntax error now.

AlinJiang avatar Feb 23 '25 20:02 AlinJiang

@AlinJiang I have solved the issue now.

anish891 avatar Feb 24 '25 10:02 anish891