diff --git a/daemon/daemon.go b/daemon/daemon.go index 10e0725..49d4ca5 100644 --- a/daemon/daemon.go +++ b/daemon/daemon.go @@ -1975,16 +1975,15 @@ func (d *Daemon) selectElement(tabID, selector, value string, selectionTimeout, changeScript := fmt.Sprintf("document.querySelector(\"%s\").dispatchEvent(new Event(\"change\", { bubbles: true }))", selector) page.Eval(changeScript) - // Verify the selection worked by checking the actual element value - verifyScript := fmt.Sprintf("document.querySelector(\"%s\").value", selector) - result, err := page.Eval(verifyScript) + // Verify the selection worked by checking the element's value property directly + currentValue, err := element.Property("value") if err != nil { return fmt.Errorf("failed to verify selection: %w", err) } // Check if the selection actually worked - if result.Value.Nil() || result.Value.String() != value { - return fmt.Errorf("failed to select option '%s' in element", value) + if currentValue.Str() != value { + return fmt.Errorf("failed to select option '%s' in element (current value: %s)", value, currentValue.Str()) } }