Click works despite error Object is present but is not visible in viewport

I have a test case that scrolls to a link at the bottom of the page and clicks it. The click action fails with the following error:

click(findTestObject('a_link')) FAILED. Reason: com.kms.katalon.core.exception.StepFailedException: Object 'Object Repository/a_link' is present but is not visible in viewport

However, it actually does click the link and redirects to the expected page. Therefore I would not expect the above failure message. The error message is misleading and requires that I use the CONTINUE_ON_FAILURE or OPTIONAL behavior. Here are the sequence of steps used to scroll and click the link:

WebUI.scrollToElement(findTestObject('a_link'), GlobalVariable.timeout)
WebUI.verifyElementInViewport(findTestObject('a_link'), GlobalVariable.timeout)
WebUI.waitForElementClickable(findTestObject('a_link'), GlobalVariable.timeout)
WebUI.click(findTestObject('a_link'))

The workaround is to use the OPTIONAL behavior for the Click step:

WebUI.click(findTestObject('a_link'), FailureHandling.OPTIONAL)

Katalon Version 5.10.1

1 Like

I have the same issue. And something interesting is,
One click “OK” button in a message box works with the error. And after I appended some more actions afterwards, it did not send error any more :sweat:
and another “click” action at the bottom did hit the same error again…

BTW, from my eyeball checking, the button is in my “ViewPoint”. So I assume it should not show the exception.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.