You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to trigger evaluateJavascript mouse focus by code to document.getElementById('txt_amount'), but it's not working on Windows Desktop. But it's working well on MacOS. When page loaded, I want it to trigger document.getElementById('txt_amount') by mouseFocusEvent, removeAttribute('required') and filled with amountValue2.value = 100 and then click button2 by document.querySelector('button').click() and submit button Continue automatically, But it's not working on Windows Desktop(it's working very well on MacOS).
var amountValue2 = document.getElementById('txt_amount');
if (amountValue2) {
amountValue2.value = 100;
} else {
console.log('amountValue2 not founded.');
}
let button2 = document.querySelector('button');
if (button2) {
button2.disabled = false;
button2.addEventListener('click', function() {
});
var mouseFocusEvent = new MouseEvent('focus', {
bubbles: true, // Allow event to bubble up the DOM tree
cancelable: true, // Allow the event to be canceled
view: window, // Specify the window object
clientX: 0, // Mouse position relative to the viewport
clientY: 0 // Mouse position relative to the viewport
});
amountValue2.addEventListener('focus', function() {
amountValue2.value = $amount;
console.log('Mouse 1 focus!');
});
window.setTimeout(() => {
amountValue2.removeAttribute('required');
amountValue2.dispatchEvent(mouseFocusEvent);
button2.focus();
button2.click();
}, 500);
} else {
console.log('Button not founded.');
}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I want to trigger evaluateJavascript mouse focus by code to document.getElementById('txt_amount'), but it's not working on Windows Desktop. But it's working well on MacOS. When page loaded, I want it to trigger document.getElementById('txt_amount') by mouseFocusEvent, removeAttribute('required') and filled with amountValue2.value = 100 and then click button2 by document.querySelector('button').click() and submit button Continue automatically, But it's not working on Windows Desktop(it's working very well on MacOS).
Beta Was this translation helpful? Give feedback.
All reactions