i'm making an autofill for a form with google extension. This is my code:
let input1 = document.querySelectorAll('.vlocity-input')[0];
input1.focus();
document.execCommand('insertText', false, 'OS Autofill');
input1.dispatchEvent(new Event('change', {bubbles: true}));
let input2 = document.querySelectorAll('.vlocity-input')[1];
input2.focus();
document.execCommand('insertText', false, 'OS Autofill');
input2.dispatchEvent(new Event('change', {bubbles: true}));
The problem here is that only gets populated the input with the focus. In this case only the second input is populated because there is where the focus() is executed for the last time. If I delete the second element and its functions, the first input will get populated correctly. So I need populate both inputs but i'm don't know how, anyone knows whats happening here?