This commit is contained in:
Josh at WLTechBlog 2025-08-18 14:09:02 -05:00
parent 6b89f37fa3
commit 3561bd1f01
1 changed files with 10 additions and 6 deletions

View File

@ -3493,14 +3493,18 @@ func (d *Daemon) interactMultiple(tabID, interactionsJSON string, timeout int) (
case "select":
// For select elements, set the value using JavaScript
script := fmt.Sprintf("(this.value = '%s', this.dispatchEvent(new Event('change', { bubbles: true })), true)", interaction.Value)
result, err := element.Eval(script)
script := fmt.Sprintf("this.value = '%s'", interaction.Value)
_, err := element.Eval(script)
if err != nil {
interactionResult.Error = fmt.Sprintf("failed to select option: %v", err)
} else if result.Value.Bool() {
interactionResult.Success = true
interactionResult.Error = fmt.Sprintf("failed to set select value: %v", err)
} else {
interactionResult.Error = fmt.Sprintf("failed to select option: %s", interaction.Value)
// Trigger change event
_, err = element.Eval("this.dispatchEvent(new Event('change', { bubbles: true }))")
if err != nil {
interactionResult.Error = fmt.Sprintf("failed to trigger change event: %v", err)
} else {
interactionResult.Success = true
}
}
case "check":