Issue while testing an identification form

To explain more precisely wha was happening, there is this new post, in hope it could may be help someone in the future.

Here is the identification form I am testing:

My goal is to, in a first time test the correct behavior of all of the textfields so I make a lot of experiments with them like giving them an empty string and verifying the presence of an error message. Nothing special until there.
There is an example of the message I am expecting if something goes wrong into textfields:

These messages are set visible or not by JavaScript, they are always present into the DOM

In a second time I test the function of the form to let a user login when its identification informations are correct and to reject the connexion when they are not. It is where the issue occurs. I use the function WebUI.setText() to enter the informations into the form and, in a previous post, I explained what problem I had with it to unfocus the element.

In this special situation I believed it was unnecessary to unfocus the password textfield because clicking on the submit button was doing the same thing and even more. I thought I was gaining time and a line of code. But it didn’t work as I expected to :sweat_smile:

Actually, there is a screen shot of the form just before the script clicks on the submit button:

As you can see I wrote into the mail/id textfield a valid mail adresse, Than I wrote into the password textfield, by doing this I set the focus to this object and the JS set the error message relative to the mail address invisible. But as the focus is still on the password textfield its error message stay visible. When the script on the submit button, the page reaches this state:

The focus has been removed from the password textfield then the JS checked this field was ok but at the moment the script clicked, the form submitting was blocked because of the error message.

I thought about some solution: add second click line command, double click, refresh the page and unfocus the password textfield before submitting. I finally chose to unfocus with the WebUI.executeJavaScript("document.activeElement.blur()", null) function. It helped me to reach my goal, submitting my identification informations and being rejected because they are not into the data base.
This is a screenshot of the message:

Hope that my explanation could help you if you encounter issue of this type, that they are clear enough and correct. Regards