Answer the question
In order to leave comments, you need to log in
Why is click not emulated?
Wrote a program to emulate user actions. In fact, a browser that records actions and can then play them back.
But for some reason, authorization in hp sv does not work for me.
She successfully assigns values to the password and login, but cannot click on the button. There are no error messages for this.
It also successfully searches for kittens in Yandex. But to perform simple actions, as authorization cannot.
You need to look in preload.js It has
ipcRenderer.on('id', (event, value) => {
do {
setTimeout(function() {
console.log('Wait for it...');
}, 1000);
} while (!!document.getElementById(value));
document.getElementById(value).click();
id = value;});
Answer the question
In order to leave comments, you need to log in
If you open the source, you can see that the program returns and writes to the script, in some cases, not id, but xpath. This is a bug in the code.
Therefore, there are no errors in the given piece of code. But they arise when this method is passed not an id, but an xpath written to the script earlier. Accordingly, it is necessary to make changes and additional checks to the code in order for the program to work as intended - it repeats the user's actions.
Alternatively, compare what the real browser sends to the server when performing actions manually, and what your program sends to the server.
Then see what exactly differs in their behavior.
If the request body is the same and the variables are all in place - then maybe HTTP headers, or maybe the server measures the time between sending the form to the client and receiving data from it, and cuts off forms sent too quickly.
The click() method works on any DOM element and always fires a 'click' event (if the element is a button inside a form and its type is submit, then a 'submit' event is also fired). The error can only be in the code (but for example, what does the condition mean - !!document.getElementById(value) - I personally do not understand)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question