This commit is contained in:
Josh at WLTechBlog 2025-08-18 16:56:20 -05:00
parent 89addac0fd
commit 42cd4ff9b7
1 changed files with 1 additions and 7 deletions

View File

@ -3498,13 +3498,7 @@ func (d *Daemon) interactMultiple(tabID, interactionsJSON string, timeout int) (
if err != nil { if err != nil {
// If text selection failed, the value might be the actual option value // If text selection failed, the value might be the actual option value
// Try to find and select by matching option value using page.Eval to avoid element.Eval issues // Try to find and select by matching option value using page.Eval to avoid element.Eval issues
script := fmt.Sprintf(` script := fmt.Sprintf(`(function(){ var el = document.querySelector("%s"); if(el) { el.value = "%s"; el.dispatchEvent(new Event('change', { bubbles: true })); } })()`, interaction.Selector, interaction.Value)
var element = document.querySelector("%s");
if (element) {
element.value = "%s";
element.dispatchEvent(new Event('change', { bubbles: true }));
}
`, interaction.Selector, interaction.Value)
_, jsErr := page.Eval(script) _, jsErr := page.Eval(script)
if jsErr == nil { if jsErr == nil {
// Verify the JavaScript selection worked by checking the element's value // Verify the JavaScript selection worked by checking the element's value