multiple
This commit is contained in:
parent
dda9dbe915
commit
3364ce6a0a
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue