multiple
This commit is contained in:
parent
ae7b92dec1
commit
62acebe8c6
|
@ -3495,19 +3495,19 @@ func (d *Daemon) interactMultiple(tabID, interactionsJSON string, timeout int) (
|
||||||
// For select elements, use page.Eval instead of element.Eval to avoid apply issues
|
// For select elements, use page.Eval instead of element.Eval to avoid apply issues
|
||||||
script := fmt.Sprintf(`
|
script := fmt.Sprintf(`
|
||||||
(() => {
|
(() => {
|
||||||
const element = document.querySelector('%s');
|
const element = document.querySelector("%s");
|
||||||
if (element && element.tagName.toLowerCase() === 'select') {
|
if (element && 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 element.options) {
|
||||||
if (option.value === '%s') {
|
if (option.value === "%s") {
|
||||||
element.value = '%s';
|
element.value = "%s";
|
||||||
element.dispatchEvent(new Event('change', { bubbles: true }));
|
element.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 element.options) {
|
||||||
if (option.text === '%s') {
|
if (option.text === "%s") {
|
||||||
element.value = option.value;
|
element.value = option.value;
|
||||||
element.dispatchEvent(new Event('change', { bubbles: true }));
|
element.dispatchEvent(new Event('change', { bubbles: true }));
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in New Issue