Open-source Python library for AI browser agents, plus Browser Use Cloud: stealth browsers and a hosted agent API.
Python ai-agentsai-toolsbrowser-agentbrowser-automationbrowser-usecdpcloud-browsercomputer-useheadless-browserllmmcpplaywrightpythonremote-browserstealth-browserweb-automationweb-scraping
Dropdown fix
Magnus Müllerec7bdbf802f3
diff --git a/browser_use/browser/watchdogs/default_action_watchdog.py b/browser_use/browser/watchdogs/default_action_watchdog.pyindex 16d68ee45..ed8322f48 100644--- a/browser_use/browser/watchdogs/default_action_watchdog.py+++ b/browser_use/browser/watchdogs/default_action_watchdog.py@@ -2418,22 +2418,24 @@ class DefaultActionWatchdog(BaseWatchdog):// Match against both text and value (case-insensitive)if (optionTextLower === targetTextLower || optionValueLower === targetTextLower) {+ // Focus the element FIRST (important for Svelte/Vue/React and other reactive frameworks)+ // This simulates the user focusing on the dropdown before changing it+ element.focus();++ // Then set the valueelement.value = option.value;option.selected = true;- // Focus the element first (important for Vue.js and reactive frameworks)- element.focus();-- // Trigger all necessary events for Vue.js and other reactive frameworks- // 1. input event - critical for Vue's v-model- const inputEvent = new Event('input', { bubbles: true });+ // Trigger all necessary events for reactive frameworks+ // 1. input event - critical for Vue's v-model and Svelte's bind:value+ const inputEvent = new Event('input', { bubbles: true, cancelable: true });element.dispatchEvent(inputEvent);- // 2. Trigger change events- const changeEvent = new Event('change', { bubbles: true });+ // 2. change event - traditional form validation and framework reactivity+ const changeEvent = new Event('change', { bubbles: true, cancelable: true });element.dispatchEvent(changeEvent);- // 3. blur event - helps with validation+ // 3. blur event - completes the interaction, triggers validationelement.blur();return {