I have a HTML page with two input-buttons and one big table (pure HTML-text = 339 kByte).
My TestCase is looking for one of these buttons:
boolean isButtonFound = WebUI.verifyElementPresent(myButtonTestObject, 1, FailureHandling.OPTIONAL)
The button is identified via attributes:
Selected Locator = "//input[@name = 'actionBtn' and @value = 'Update' and @type = 'submit']"
If the button is there, the test is supposed to do action A, if the button is missing the test is supposed to do action B. This works in 98% of all test runs.
But sometimes, the button is not found by “verifyElementPresent()”, although it is visible on the screenshot, which is automatically taken when “WebElementNotFoundException” is thrown (button has not been found). Looking at the AUT’s state, the button should be there, too. But since it is not found, the test case chooses action B. Action B does not fit to the AUT’s state and the test run fails.
The button is defined in line 300 of the HTML page with a total of 22.500 lines. Delivery to the testbrowser should happen quite early.
All this is packed in a while loop:
...
while(true) {
WebUI.waitForPageLoad(10)
WebUI.delay(3)
boolean isButtonFound = WebUI.verifyElementPresent(myButtonTestObject, 1, FailureHandling.OPTIONAL)
if (!(isButtonFound)) {
break; // action B
}
WebUI.click(myButtonTestObject) // action A: reload the HTML page
}
I am using Katalon Studio 7.1.2 with Firefox 60.9.0esr.
Do you have any ideas, who to avoid the “button not found, although it is there” problem?
Thanks for reading!