Issue with WebUI.waitForElementVisible()


Is anyone having issues with using:

WebUI.waitForElementVisible(findTestObject('Page_Login/btn_Login'), 10)

The issue i am having is with false positives, ie, when a failure has occurred such as ‘Unable to find element’, the test step is still passing. I expect the test to fail, but rather worryingly passes.

I have added an assertion so to test the return value of:

WebUI.waitForElementVisible(findTestObject('Page_Login/btn_Login'), 10)

which fails tests as id expect, but it seems odd that the method isnt failing tests by default. Is this potentially a bug or am i missing something?


Looking at the relevant part of the waitForElementVisible() keyword:

} catch (WebElementNotFoundException e) {
     return false
} catch (TimeoutException e) {
     logger.logWarning(MessageFormat.format(StringConstants.KW_MSG_OBJ_IS_NOT_VISIBLE_AFTER_X_SEC, [to.getObjectId(), timeOut] as Object[]))
     return false

… by default, in the event that the element is NOT present/visible, the method logs a warning, and returns false. This is expected, as the waitForElement__() family of methods is not generally meant to be an assertion that passes/fails, but to help with timing. You can, however, ask it to fail the test case by passing an extra FailureHandling argument:

WebUI.waitForElementVisible(findTestObject('Page_Login/btn_Login'), 10, FailureHandling.STOP_ON_FAILURE)


Thanks @Brandon_Hein

I have tried this but no luck, im using:

CucumberKW.runFeatureFile('Include/features/New Feature File.feature', FailureHandling.STOP_ON_FAILURE)

Is this a Cucumber specific issue?

Probably. It looks like you are using a non-native keyword (from a plugin, maybe?). You would need to check the usage of that particular method, but I highly doubt it accepts a FailureHandling argument.