I have a doubt about this.
I made a test case
import com.kms.katalon.core.model.FailureHandling
import com.kms.katalon.core.testobject.ConditionType
import com.kms.katalon.core.testobject.TestObject
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI
WebUI.openBrowser("http://demoaut.katalon.com/")
WebUI.waitForElementVisible(makeTO("//a[text()='Make Appointment']"), 5) // (1)
TestObject disappointment = makeTO("//a[text()='Disappointment']")
WebUI.waitForElementVisible(disappointment, 5, FailureHandling.OPTIONAL) // (2)
WebUI.waitForElementVisible(disappointment, 5, FailureHandling.CONTINUE_ON_FAILURE) // (3)
WebUI.waitForElementVisible(disappointment, 5, FailureHandling.STOP_ON_FAILURE) // (4)
WebUI.closeBrowser()
TestObject makeTO(String xpath) {
TestObject to = new TestObject(xpath)
to.addProperty("xpath", ConditionType.EQUALS, xpath)
return to
}
The code calls WebUI.waitForElementVisible()
3 times with 3 FailureHandling options — OPTIONAL, CONTINUE_ON_FAILURE, STOP_ON_FAILURE. Here I specified a Test Object that points to non-existing web element, therefore all 3 times of Keyword invocation would fail. The question we ask is if the timeout value “5” is respected or not. I have the project’s default timeout for wait to be 30 seconds.
When I ran it, I saw the following output in the Console
2022-04-30 08:55:07.281 INFO c.k.katalon.core.main.TestCaseExecutor - --------------------
2022-04-30 08:55:07.286 INFO c.k.katalon.core.main.TestCaseExecutor - START Test Cases/waitForElementVisible_CONTINUE
2022-04-30 08:55:08.261 DEBUG testcase.waitForElementVisible_CONTINUE - 1: openBrowser("http://demoaut.katalon.com/")
...
2022-04-30 08:55:15.819 DEBUG testcase.waitForElementVisible_CONTINUE - 2: waitForElementVisible(makeTO("//a[text()='Make Appointment']"), 5)
2022-04-30 08:55:15.823 DEBUG testcase.waitForElementVisible_CONTINUE - 1: to = new com.kms.katalon.core.testobject.TestObject(xpath)
2022-04-30 08:55:15.831 DEBUG testcase.waitForElementVisible_CONTINUE - 2: to.addProperty("xpath", EQUALS, xpath)
2022-04-30 08:55:15.849 DEBUG testcase.waitForElementVisible_CONTINUE - 3: return to
2022-04-30 08:55:16.405 DEBUG testcase.waitForElementVisible_CONTINUE - 3: disappointment = makeTO("//a[text()='Disappointment']")
2022-04-30 08:55:16.407 DEBUG testcase.waitForElementVisible_CONTINUE - 1: to = new com.kms.katalon.core.testobject.TestObject(xpath)
2022-04-30 08:55:16.409 DEBUG testcase.waitForElementVisible_CONTINUE - 2: to.addProperty("xpath", EQUALS, xpath)
2022-04-30 08:55:16.412 DEBUG testcase.waitForElementVisible_CONTINUE - 3: return to
2022-04-30 08:55:16.415 DEBUG testcase.waitForElementVisible_CONTINUE - 4: waitForElementVisible(disappointment, 5, OPTIONAL)
2022-04-30 08:55:22.484 INFO c.k.k.c.webui.common.WebUiCommonHelper - Unable to find the element located by 'By.xpath: //a[text()='Disappointment']'. Please recheck the objects properties to make sure the desired element is located.
2022-04-30 08:55:22.521 WARN k.k.c.w.k.b.WaitForElementVisibleKeyword - Web element with id: '//a[text()='Disappointment']' located by '//a[text()='Disappointment']' not found
2022-04-30 08:55:22.525 DEBUG testcase.waitForElementVisible_CONTINUE - 5: waitForElementVisible(disappointment, 5, CONTINUE_ON_FAILURE)
2022-04-30 08:55:28.682 INFO c.k.k.c.webui.common.WebUiCommonHelper - Unable to find the element located by 'By.xpath: //a[text()='Disappointment']'. Please recheck the objects properties to make sure the desired element is located.
2022-04-30 08:55:28.685 WARN k.k.c.w.k.b.WaitForElementVisibleKeyword - Web element with id: '//a[text()='Disappointment']' located by '//a[text()='Disappointment']' not found
2022-04-30 08:55:28.691 DEBUG testcase.waitForElementVisible_CONTINUE - 6: waitForElementVisible(disappointment, 5, STOP_ON_FAILURE)
2022-04-30 08:55:34.804 INFO c.k.k.c.webui.common.WebUiCommonHelper - Unable to find the element located by 'By.xpath: //a[text()='Disappointment']'. Please recheck the objects properties to make sure the desired element is located.
2022-04-30 08:55:34.806 WARN k.k.c.w.k.b.WaitForElementVisibleKeyword - Web element with id: '//a[text()='Disappointment']' located by '//a[text()='Disappointment']' not found
2022-04-30 08:55:34.808 DEBUG testcase.waitForElementVisible_CONTINUE - 7: closeBrowser()
2022-04-30 08:55:34.961 INFO c.k.katalon.core.main.TestCaseExecutor - END Test Cases/waitForElementVisible_CONTINUE
I think that the specified timeout 5 was respected in all cases.
We can read the source of WebUI.waitForKeywordVisible keyword at
I think that the WebUI.waitForElementVisible keyword treats 3 options of FlowControl (OPTIONAL, CONTINUE_ON_FAILURE, STOP_ON_FAILURE) in a similar manner. Your observation does not explain the processing flow observable in the source code very well.