This commit is contained in:
Josh at WLTechBlog 2025-08-18 14:15:32 -05:00
parent ae7b92dec1
commit 62acebe8c6
1 changed files with 4 additions and 4 deletions

View File

@ -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
script := fmt.Sprintf(`
(() => {
const element = document.querySelector('%s');
const element = document.querySelector("%s");
if (element && element.tagName.toLowerCase() === 'select') {
// Try to select by value first
for (let option of element.options) {
if (option.value === '%s') {
element.value = '%s';
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') {
if (option.text === "%s") {
element.value = option.value;
element.dispatchEvent(new Event('change', { bubbles: true }));
return true;