From 3364ce6a0abc6606579c2c53bbe8113af8a8da41 Mon Sep 17 00:00:00 2001 From: Josh at WLTechBlog Date: Mon, 18 Aug 2025 13:43:05 -0500 Subject: [PATCH] multiple --- daemon/daemon.go | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/daemon/daemon.go b/daemon/daemon.go index 0fe847a..0d137ef 100644 --- a/daemon/daemon.go +++ b/daemon/daemon.go @@ -3494,27 +3494,29 @@ func (d *Daemon) interactMultiple(tabID, interactionsJSON string, timeout int) ( case "select": // For select elements, use JavaScript to set the value script := fmt.Sprintf(` - const element = arguments[0]; - if (element.tagName.toLowerCase() === 'select') { - // Try to select by value first - for (let option of element.options) { - if (option.value === '%s') { - element.value = '%s'; - element.dispatchEvent(new Event('change', { bubbles: true })); - return true; + (function() { + const element = arguments[0]; + if (element.tagName.toLowerCase() === 'select') { + // Try to select by value first + for (let option of element.options) { + if (option.value === '%s') { + element.value = '%s'; + element.dispatchEvent(new Event('change', { bubbles: true })); + return true; + } } - } - // Try to select by text if value didn't work - for (let option of element.options) { - if (option.text === '%s') { - element.value = option.value; - element.dispatchEvent(new Event('change', { bubbles: true })); - return true; + // Try to select by text if value didn't work + for (let option of element.options) { + if (option.text === '%s') { + element.value = option.value; + element.dispatchEvent(new Event('change', { bubbles: true })); + return true; + } } + return false; } return false; - } - return false; + })() `, interaction.Value, interaction.Value, interaction.Value) result, err := element.Eval(script)