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":
|
||||
// For select elements, use JavaScript to set the value
|
||||
script := fmt.Sprintf(`
|
||||
(function() {
|
||||
const element = this;
|
||||
if (element.tagName.toLowerCase() === 'select') {
|
||||
(() => {
|
||||
if (this.tagName.toLowerCase() === 'select') {
|
||||
// Try to select by value first
|
||||
for (let option of element.options) {
|
||||
for (let option of this.options) {
|
||||
if (option.value === '%s') {
|
||||
element.value = '%s';
|
||||
element.dispatchEvent(new Event('change', { bubbles: true }));
|
||||
this.value = '%s';
|
||||
this.dispatchEvent(new Event('change', { bubbles: true }));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// 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') {
|
||||
element.value = option.value;
|
||||
element.dispatchEvent(new Event('change', { bubbles: true }));
|
||||
this.value = option.value;
|
||||
this.dispatchEvent(new Event('change', { bubbles: true }));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue