Why not simulating a click?

Wrote program to simulate user actions. In fact the browser that records the activity and can then play.
But for some reason my authentication fails in hp sv.
It successfully sets the password and login but can't click on. Error messages no.
It also successfully looking for kittens in Yandex. But to perform simple actions, how authorization can not.
You have to look at preload.js it has
ipcRenderer.on('id', (event, value) => {
 do {
 setTimeout(function() {
 console.log('Wait for it...');
 }, 1000);
 } while (!!document.getElementById(value));
 id = value;});

What can there be wrong?
June 3rd 19 at 19:26
3 answers
June 3rd 19 at 19:28
If you open the source code, we can see that the program returns and writes in the script, in some cases, not id, and xpath. This is a bug in the code.
Therefore, in the above piece of code there are no errors. But they arise when this method is not id, the xpath is written in the script earlier. Accordingly, it is necessary to make changes and additional check in the code to ensure that the program worked as intended - did the actions of the user.
June 3rd 19 at 19:30
Alternatively, compare what a real browser sends to the server when you manually perform actions, and sends that to the server your program.
Then see what in their behavior is different.
If the request body is the same and variables all over the place something can be, HTTP headers, and maybe, the server measures the time between sending the form to the client and receiving data from it, and cuts off the forms submitted too quickly.
The program itself is a browser and it sends the same thing as the browser. Check it does not make sense. - kallie.Durgan43 commented on June 3rd 19 at 19:33
June 3rd 19 at 19:32
The method click() works on any DOM element and generates a 'click' event always (if the element is a button inside of a form, and its type is submit, at the same time is generated and the event 'submit'). Error can be only in the code (naprimer what the condition is !!document.getElementById(value) - I personally don't understand)
!!document.getElementById(value) returns true or false depending on whether the item.
I'm experimenting with the search button of Google. She is from the console of the developer tools js I not clinging. - kallie.Durgan43 commented on June 3rd 19 at 19:35

Find more questions by tags JavaScriptNode.js