multiple
This commit is contained in:
parent
7fda3a32ed
commit
166deca9f9
|
@ -3494,26 +3494,29 @@ 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(`
|
||||||
if (this.tagName.toLowerCase() === 'select') {
|
(() => {
|
||||||
// Try to select by value first
|
if (this.tagName.toLowerCase() === 'select') {
|
||||||
for (let option of this.options) {
|
// Try to select by value first
|
||||||
if (option.value === '%s') {
|
|
||||||
this.value = '%s';
|
|
||||||
this.dispatchEvent(new Event('change', { bubbles: true }));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Try to select by text if value didn't work
|
|
||||||
if (this.value !== '%s') {
|
|
||||||
for (let option of this.options) {
|
for (let option of this.options) {
|
||||||
if (option.text === '%s') {
|
if (option.value === '%s') {
|
||||||
this.value = option.value;
|
this.value = '%s';
|
||||||
this.dispatchEvent(new Event('change', { bubbles: true }));
|
this.dispatchEvent(new Event('change', { bubbles: true }));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Try to select by text if value didn't work
|
||||||
|
if (this.value !== '%s') {
|
||||||
|
for (let option of this.options) {
|
||||||
|
if (option.text === '%s') {
|
||||||
|
this.value = option.value;
|
||||||
|
this.dispatchEvent(new Event('change', { bubbles: true }));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
return true;
|
||||||
|
})()
|
||||||
`, interaction.Value, interaction.Value, interaction.Value, interaction.Value)
|
`, interaction.Value, interaction.Value, interaction.Value, interaction.Value)
|
||||||
|
|
||||||
_, err := element.Eval(script)
|
_, err := element.Eval(script)
|
||||||
|
|
Loading…
Reference in New Issue