Hi folks,
my test execution in a conditional statement (if) jumps into the block, even the given element is not visible. That shall not be the case…
The test is a login process with a for loop and should look like this (simplified):
For Loop (row <= TestData, row++) {
Enter E-Mail & Password → click “Login”
If "element is present “Login successful” {than proceed into the block where you click “my Account” and BREAK}
}
If the elemt is not present, the for loop starts again. But what happens is, that the system always says, the “Login successful” is present, even it is not.
My code segment:
for (def rowNum = 1; rowNum <= findTestData(‘Nutzer_und_Passwort’).getRowNumbers(); rowNum++) {
WebUI.clearText(findTestObject(‘Inputfields/input_Login_E-Mail’), FailureHandling.STOP_ON_FAILURE)
WebUI.clearText(findTestObject('Inputfields/input_Login_Passwort'), FailureHandling.STOP_ON_FAILURE)
WebUI.sendKeys(findTestObject('Inputfields/input_Login_E-Mail'), findTestData('Nutzer_und_Passwort').getValue(1, rowNum))
WebUI.sendKeys(findTestObject('Inputfields/input_Login_Passwort'), findTestData('Nutzer_und_Passwort').getValue(2, rowNum))
WebUI.click(findTestObject('Buttons/btn_Modal_Login'))
//Thread.sleep(700)
**if (WebUI.waitForElementNotVisible(findTestObject('Messages/div_Login_erfolgreich'), 1) == true)** {
WebUI.waitForElementClickable(findTestObject('Buttons/btn_Startseite_Mein-Konto'), 6)
WebUI.click(findTestObject('Buttons/btn_Mein-Konto_toggle'))
WebUI.click(findTestObject('Buttons/btn_Startseite_Mein-Konto'), FailureHandling.STOP_ON_FAILURE)
break
}
}
The Object’s property by attribute says:
//div[@id = ‘loginmessage’ and @class = ‘alert alert-success’ and (contains(text(), ‘Login erfolgreich. Bitte warten Sie…’) or contains(., ‘Login erfolgreich. Bitte warten Sie…’))]
Am i did something wrong or is that a bug? The test was working just fine but i haven’t executed it for a while (like ~1 to 1,5 months). I searched the HTML Code for the element and it is definetly not present. Please help.
Thanks in advance and kind regards,
M. Dietrich
Edit: When i rerun the rest from the beginning of the for loop, the test case will finish with a successful login…