Issue while testing an identification form

Hello to everyone :raising_hand_man:

I am testing an identification form to login on the web site I am working on. A strange “error” occurs during the process. I want to understand why this occurs and how to fix it.

There is simple and clean (as possible) explanation of what I want to achieve:
•set wrong identification to the fields of mail and password
•submit them by clicking on the submit button
•verify I am still on the identification page and that an error message appears

This test is only a part of all the script, before doing this I am testing different thing on fields like is a string accepted when it is not a valid mail address or what is happening when I enter an empty string to the fields.
Beside when I reach this particular point my test failed. Actually the test is still on the identification page, I am checking it with the title of the page, but no trace of the error message I am expecting for.
In the log the click on submit button is marked as passed but when I am watching the test processing, the page doesn’t seem to react to it. No loading sign nor moving, nothing :thinking:

I remarked that if I manually click on the button, the test was passing through this difficulty. Then I add a second click command in my script, it fixes but it is not an acceptable solution (I think :sweat_smile: or at least use doubleClick maybe?)

I have also tried to blur the last field I am interacting with before clicking on the submit button and it helped but as it is a process I am using in other test and where the error doesn’t occur I feel strange to add this command for this particular case…

I’ve tried delay but as I said, there no move on the page so it doesn’t work, there is nothing to wait for. I’ve read topic on waitForPageLoad, I don’t think it will help either but after all I don’t know and I am looking for solution. What is your point of view on this situation? In advance thank for your answer :wink:

Here follows my code (the part with error is near to the end, the code is a bit long sorry):

    //création de l'objet de test: champ de texte identifiant
    TestObject fieldset_mail = new TestObject('champ de texte identifiant')
    fieldset_mail.addProperty('xpath', ConditionType.EQUALS, '//input[@id=\'dbkz\']')

    //création de l'objet de test: message erreur mail manquant
    TestObject err_msg_mail_requis = new TestObject('message erreur mail requis')
    err_msg_mail_requis.addProperty('xpath', ConditionType.EQUALS, '//div[@id=\'advice-required-dbkz\']')

    //création de l'objet de test: message erreur mail invalide
    TestObject err_msg_mail_invalide = new TestObject('message erreur mail invalide')
    err_msg_mail_invalide.addProperty('xpath', ConditionType.EQUALS, '//div[@id=\'advice-validate-email-dbkz\']')

    //création de l'objet de test: champ de texte mot de passe
    TestObject fieldset_pswd = new TestObject('champ de texte mot de passe')
    fieldset_pswd.addProperty('xpath', ConditionType.EQUALS, '//input[@id=\'pswd\']')

    //création de l'objet de test: message erreur mot de passe absent
    TestObject err_msg_pswd = new TestObject('message erreur mot de passe absent')
    err_msg_pswd.addProperty('xpath', ConditionType.EQUALS, '//div[@id=\'advice-required-pswd\']')

    //création de l'ojet de test: case à cocher enregistrer la connexion
    TestObject case_svco = new TestObject('bouton enregistrer les informations de connexion')
    case_svco.addProperty('xpath', ConditionType.EQUALS, '//input[@id=\'ic\']')

    //création de l'objet de test: bouton identification
    TestObject button_iden = new TestObject('bouton identification')
    button_iden.addProperty('xpath', ConditionType.EQUALS, '//button[@name=\'submit\']')

    //création de l'objet de test: titre page accueil personnel
    TestObject valid_ID_title = new TestObject('titre accueil personnel')
    valid_ID_title.addProperty('xpath', ConditionType.EQUALS, '//h2/span[contains(text(), \'Accueil personnel\')]')

    //création de l'objet de test: message erreur connexion mdp ou id invalide
    TestObject err_msg_id = new TestObject('message erreur invalde mdp ou id')
    err_msg_id.addProperty('xpath', ConditionType.EQUALS, '//p[@class=\'msg erreur\']')

    //création de l'objet de test: titre page accueil principal
    TestObject main_title = new TestObject('titre page acceuil principal')
    main_title.addProperty('xpath', ConditionType.EQUALS, '//h1')

    //création de l'objet de test: acces direct a l'application
    TestObject button_access = new TestObject('Bouton acces a l\'application')
    button_access.addProperty('xpath', ConditionType.EQUALS, '//a[contains(text(), \'Accès\')]')

    //création de l'objet de test: titre page identification
    TestObject identification_title = new TestObject('titre de la page d\'idendtification')
    identification_title.addProperty('xpath', ConditionType.EQUALS, '//h2/span[contains(text(), \'Identification\')]')

    //Vérification clic sans adresse mail
    KeywordUtil.logInfo("Verification clic sans adresse mail")

    WebUI.setText(fieldset_mail, "")
    WebUI.setText(fieldset_pswd, "fakepswd")


    //Verification bouton enregistrement des informations de connexions
    KeywordUtil.logInfo("Verification case à cocher")


    //Vérification identification
    KeywordUtil.logInfo("Vérification identification")

    //Verification fausse adresse faux mot de passe
    KeywordUtil.logInfo("Verification fausse adresse mail faux mot de passe")

//Where the error occurs

    WebUI.setText(fieldset_mail, "")
    WebUI.setText(fieldset_pswd, "fakePswd123")


    if (WebUI.getAttribute(fieldset_mail, 'value') == "") {
    KeywordUtil.markPassed("L'adresse mail est bien conservée")
    } else {
    KeywordUtil.markError("L'adresse n'est pas conservée")

    if (WebUI.getAttribute(fieldset_pswd, 'value') == "") {
    KeywordUtil.markPassed("Le champ de texte du mot de passe est bien nettoyé")
    } else {
    KeywordUtil.markError("Le champ de texte du mot de passe n'est pas nettoyé")


Here is the log report:

To prevent people for search for a solution and waste time I inform you I found what was happening. I decided with my colleague to apply WebUI.executeJavaScript("document.activeElement.blur()", null) before clicking. That fix the problem and it corresponds to the situation (We watched the test set by step many times and we finally understood what block us)
Thnaks :slight_smile:


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