bump
This commit is contained in:
parent
1e142c1f3f
commit
35a2ed62c7
|
@ -1967,29 +1967,28 @@ func (d *Daemon) selectElement(tabID, selector, value string, selectionTimeout,
|
||||||
// If text selection failed, use JavaScript as fallback
|
// If text selection failed, use JavaScript as fallback
|
||||||
// This handles both option value and option text selection
|
// This handles both option value and option text selection
|
||||||
script := fmt.Sprintf(`
|
script := fmt.Sprintf(`
|
||||||
(function() {
|
|
||||||
var select = document.querySelector("%s");
|
var select = document.querySelector("%s");
|
||||||
if (!select) return null;
|
var result = null;
|
||||||
|
if (select) {
|
||||||
// First try to select by value
|
// First try to select by value
|
||||||
select.value = "%s";
|
select.value = "%s";
|
||||||
if (select.value === "%s") {
|
if (select.value === "%s") {
|
||||||
select.dispatchEvent(new Event('change', { bubbles: true }));
|
select.dispatchEvent(new Event('change', { bubbles: true }));
|
||||||
return select.value;
|
result = select.value;
|
||||||
}
|
} else {
|
||||||
|
|
||||||
// If value selection failed, try to find by text content
|
// If value selection failed, try to find by text content
|
||||||
var options = select.options;
|
var options = select.options;
|
||||||
for (var i = 0; i < options.length; i++) {
|
for (var i = 0; i < options.length; i++) {
|
||||||
if (options[i].text === "%s") {
|
if (options[i].text === "%s") {
|
||||||
select.selectedIndex = i;
|
select.selectedIndex = i;
|
||||||
select.dispatchEvent(new Event('change', { bubbles: true }));
|
select.dispatchEvent(new Event('change', { bubbles: true }));
|
||||||
return select.value;
|
result = select.value;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return null;
|
}
|
||||||
})()
|
result;
|
||||||
`, selector, value, value, value)
|
`, selector, value, value, value)
|
||||||
|
|
||||||
// Execute JavaScript and get the result
|
// Execute JavaScript and get the result
|
||||||
|
@ -3602,29 +3601,28 @@ func (d *Daemon) interactMultiple(tabID, interactionsJSON string, timeout int) (
|
||||||
// If text selection failed, use JavaScript as fallback
|
// If text selection failed, use JavaScript as fallback
|
||||||
// This handles both option value and option text selection
|
// This handles both option value and option text selection
|
||||||
script := fmt.Sprintf(`
|
script := fmt.Sprintf(`
|
||||||
(function() {
|
|
||||||
var select = document.querySelector("%s");
|
var select = document.querySelector("%s");
|
||||||
if (!select) return null;
|
var result = null;
|
||||||
|
if (select) {
|
||||||
// First try to select by value
|
// First try to select by value
|
||||||
select.value = "%s";
|
select.value = "%s";
|
||||||
if (select.value === "%s") {
|
if (select.value === "%s") {
|
||||||
select.dispatchEvent(new Event('change', { bubbles: true }));
|
select.dispatchEvent(new Event('change', { bubbles: true }));
|
||||||
return select.value;
|
result = select.value;
|
||||||
}
|
} else {
|
||||||
|
|
||||||
// If value selection failed, try to find by text content
|
// If value selection failed, try to find by text content
|
||||||
var options = select.options;
|
var options = select.options;
|
||||||
for (var i = 0; i < options.length; i++) {
|
for (var i = 0; i < options.length; i++) {
|
||||||
if (options[i].text === "%s") {
|
if (options[i].text === "%s") {
|
||||||
select.selectedIndex = i;
|
select.selectedIndex = i;
|
||||||
select.dispatchEvent(new Event('change', { bubbles: true }));
|
select.dispatchEvent(new Event('change', { bubbles: true }));
|
||||||
return select.value;
|
result = select.value;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return null;
|
}
|
||||||
})()
|
result;
|
||||||
`, interaction.Selector, interaction.Value, interaction.Value, interaction.Value)
|
`, interaction.Selector, interaction.Value, interaction.Value, interaction.Value)
|
||||||
|
|
||||||
// Execute JavaScript and get the result
|
// Execute JavaScript and get the result
|
||||||
|
@ -3824,29 +3822,28 @@ func (d *Daemon) fillFormBulk(tabID, formSelector, fieldsJSON string, timeout in
|
||||||
// If text selection failed, use JavaScript as fallback
|
// If text selection failed, use JavaScript as fallback
|
||||||
// This handles both option value and option text selection
|
// This handles both option value and option text selection
|
||||||
script := fmt.Sprintf(`
|
script := fmt.Sprintf(`
|
||||||
(function() {
|
|
||||||
var select = document.querySelector("%s");
|
var select = document.querySelector("%s");
|
||||||
if (!select) return null;
|
var result = null;
|
||||||
|
if (select) {
|
||||||
// First try to select by value
|
// First try to select by value
|
||||||
select.value = "%s";
|
select.value = "%s";
|
||||||
if (select.value === "%s") {
|
if (select.value === "%s") {
|
||||||
select.dispatchEvent(new Event('change', { bubbles: true }));
|
select.dispatchEvent(new Event('change', { bubbles: true }));
|
||||||
return select.value;
|
result = select.value;
|
||||||
}
|
} else {
|
||||||
|
|
||||||
// If value selection failed, try to find by text content
|
// If value selection failed, try to find by text content
|
||||||
var options = select.options;
|
var options = select.options;
|
||||||
for (var i = 0; i < options.length; i++) {
|
for (var i = 0; i < options.length; i++) {
|
||||||
if (options[i].text === "%s") {
|
if (options[i].text === "%s") {
|
||||||
select.selectedIndex = i;
|
select.selectedIndex = i;
|
||||||
select.dispatchEvent(new Event('change', { bubbles: true }));
|
select.dispatchEvent(new Event('change', { bubbles: true }));
|
||||||
return select.value;
|
result = select.value;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return null;
|
}
|
||||||
})()
|
result;
|
||||||
`, fieldResult.Selector, fieldValue, fieldValue, fieldValue)
|
`, fieldResult.Selector, fieldValue, fieldValue, fieldValue)
|
||||||
|
|
||||||
// Execute JavaScript and get the result
|
// Execute JavaScript and get the result
|
||||||
|
|
Loading…
Reference in New Issue