bump
This commit is contained in:
parent
303a7bd5f7
commit
9a8200de41
|
@ -1966,7 +1966,10 @@ func (d *Daemon) selectElement(tabID, selector, value string, selectionTimeout,
|
|||
if err != nil {
|
||||
// If text selection failed, use JavaScript as fallback
|
||||
// Use the simplest approach that works with rod - just set the value and dispatch event
|
||||
script := fmt.Sprintf(`document.querySelector('%s').value = '%s'; document.querySelector('%s').dispatchEvent(new Event('change', { bubbles: true })); document.querySelector('%s').value`, selector, value, selector, selector)
|
||||
// Escape quotes in selector and value to avoid JavaScript syntax errors
|
||||
escapedSelector := strings.ReplaceAll(selector, "'", "\\'")
|
||||
escapedValue := strings.ReplaceAll(value, "'", "\\'")
|
||||
script := fmt.Sprintf(`document.querySelector('%s').value = '%s'; document.querySelector('%s').dispatchEvent(new Event('change', { bubbles: true })); document.querySelector('%s').value`, escapedSelector, escapedValue, escapedSelector, escapedSelector)
|
||||
|
||||
// Execute JavaScript and get the result
|
||||
result, err := page.Eval(script)
|
||||
|
@ -3577,7 +3580,10 @@ func (d *Daemon) interactMultiple(tabID, interactionsJSON string, timeout int) (
|
|||
if err != nil {
|
||||
// If text selection failed, use JavaScript as fallback
|
||||
// Use the simplest approach that works with rod - just set the value and dispatch event
|
||||
script := fmt.Sprintf(`document.querySelector('%s').value = '%s'; document.querySelector('%s').dispatchEvent(new Event('change', { bubbles: true })); document.querySelector('%s').value`, interaction.Selector, interaction.Value, interaction.Selector, interaction.Selector)
|
||||
// Escape quotes in selector and value to avoid JavaScript syntax errors
|
||||
escapedSelector := strings.ReplaceAll(interaction.Selector, "'", "\\'")
|
||||
escapedValue := strings.ReplaceAll(interaction.Value, "'", "\\'")
|
||||
script := fmt.Sprintf(`document.querySelector('%s').value = '%s'; document.querySelector('%s').dispatchEvent(new Event('change', { bubbles: true })); document.querySelector('%s').value`, escapedSelector, escapedValue, escapedSelector, escapedSelector)
|
||||
|
||||
// Execute JavaScript and get the result
|
||||
result, err := page.Eval(script)
|
||||
|
@ -3775,7 +3781,10 @@ func (d *Daemon) fillFormBulk(tabID, formSelector, fieldsJSON string, timeout in
|
|||
if err != nil {
|
||||
// If text selection failed, use JavaScript as fallback
|
||||
// Use the simplest approach that works with rod - just set the value and dispatch event
|
||||
script := fmt.Sprintf(`document.querySelector('%s').value = '%s'; document.querySelector('%s').dispatchEvent(new Event('change', { bubbles: true })); document.querySelector('%s').value`, fieldResult.Selector, fieldValue, fieldResult.Selector, fieldResult.Selector)
|
||||
// Escape quotes in selector and value to avoid JavaScript syntax errors
|
||||
escapedSelector := strings.ReplaceAll(fieldResult.Selector, "'", "\\'")
|
||||
escapedValue := strings.ReplaceAll(fieldValue, "'", "\\'")
|
||||
script := fmt.Sprintf(`document.querySelector('%s').value = '%s'; document.querySelector('%s').dispatchEvent(new Event('change', { bubbles: true })); document.querySelector('%s').value`, escapedSelector, escapedValue, escapedSelector, escapedSelector)
|
||||
|
||||
// Execute JavaScript and get the result
|
||||
jsResult, err := page.Eval(script)
|
||||
|
|
Loading…
Reference in New Issue