multiple
This commit is contained in:
parent
60b717efbd
commit
f888ab8026
|
@ -3494,22 +3494,21 @@ func (d *Daemon) interactMultiple(tabID, interactionsJSON string, timeout int) (
|
||||||
case "select":
|
case "select":
|
||||||
// For select elements, use JavaScript to set the value
|
// For select elements, use JavaScript to set the value
|
||||||
script := fmt.Sprintf(`
|
script := fmt.Sprintf(`
|
||||||
(function() {
|
(() => {
|
||||||
const element = this;
|
if (this.tagName.toLowerCase() === 'select') {
|
||||||
if (element.tagName.toLowerCase() === 'select') {
|
|
||||||
// Try to select by value first
|
// Try to select by value first
|
||||||
for (let option of element.options) {
|
for (let option of this.options) {
|
||||||
if (option.value === '%s') {
|
if (option.value === '%s') {
|
||||||
element.value = '%s';
|
this.value = '%s';
|
||||||
element.dispatchEvent(new Event('change', { bubbles: true }));
|
this.dispatchEvent(new Event('change', { bubbles: true }));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Try to select by text if value didn't work
|
// Try to select by text if value didn't work
|
||||||
for (let option of element.options) {
|
for (let option of this.options) {
|
||||||
if (option.text === '%s') {
|
if (option.text === '%s') {
|
||||||
element.value = option.value;
|
this.value = option.value;
|
||||||
element.dispatchEvent(new Event('change', { bubbles: true }));
|
this.dispatchEvent(new Event('change', { bubbles: true }));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue