[WebUI] Verify Text Present method timeout value

How is it possible to set timeout value for WebUI.verifyTextPresent(‘Text to search’, false, FailureHandling.OPTIONAL) method? It waits for too much time, slowing down execution, because I need to use more than one.

1 Like

I think WebUI.verifyTextPresent() does not wait at all. If your test case is slow, there must be some other reason. Possibly you have other call to verify*(), which is waiting long.

-----------

I made a demo project and confirmed WebUI.verifyTextPresent() does not wait. See the following screenshot. It proves that WebUI.verifyTextPresent() does not wait, and fails as soon as it finds the expected text is not present.

KatalonDiscussion10256.png

1 Like

Hi plaidshirtakos,

WebUI.verifyTextPresent, WebUI.click & other verification keywords do not include timeout arguments.

Therefore, I use ‘Wait for element Web’ UI keywords which do include timeout arguments.

The keywords I use are dependent on my needs.

I generally use “Wait for Element Visible” before using WebUI.click (and other keywords) to ensure the test step can find the test object(s).

Example #1 (waits up-to 30 secs before continuing):
This should work because Katalon first checks the object’s visibility before clicking on the object.
WebUI.waitForElementVisible(findTestObject(‘CliientLoginBtn’), 30, FailureHandling.OPTIONAL)
WebUI.click(findTestObject(‘CliientLoginBtn’))

To use “WebUI.verifyTextPresent” I first find an object on the page that I can use “WebUI.waitForElementVisible” with, then I use the “WebUI.verifyTextPresent” keyword.

Example #2 (waits up-to 30 secs before continuing):
>> This is from kazurayam’s example:
This should work because Katalon first checks the object’s visibility and then checks the text.
WebUI.waitForElementVisible(findTestObject(‘Object Repository/Page_CURA Healthcare Service/a_Make Appointment’), 30, FailureHandling.OPTIONAL)
WebUI.verifyTextPresent(‘We care About Your Health’, false)
WebUI.verifyTextPresent(‘We Do Not care About Your Wealth’, false)

I was using WebUI.verifyTextPresent() to check if text was displayed after a period of time.

This wasnt great as i found network conditions were helping this to fail.

I turned to using WebUI.waitForPageLoad() which was far better thing to use in my case.

Might be helpful to others having issues using WebUI.verifyTextPresent()

2 Likes