2

When running the following code (in Katalon Studio):

if (WebUI.verifyElementPresent(findTestObject('Object Repository/xyz'), 
    5, FailureHandling.OPTIONAL)) {
    WebUI.click(findTestObject('xyz'))
}

I received the following error message:

Test Cases/abc FAILED because (of) Unable to click on object 'Object 
Repository/xyz' (Root cause: org.openqa.selenium.ElementNotVisibleException: 
element not visible)

So, even though the presence of the object is optional, I get an error message. Did you have a similar case?

  • the presence of the object is optional what tells you that the presence is optional? – Adelin Feb 16 '18 at 13:35
  • As I understand the "FailureHandling.OPTIONAL" part, this code should click the xyz Test Object if present, do nothing otherwise. No? – Mate Mrše Feb 16 '18 at 13:47
  • 1
    It tells me that it's not mandatory to handle failures – Adelin Feb 16 '18 at 13:48
  • 1
    My intention with this code is: "if the element is present, click it, if not continue...". So, if the element is not present, why should I get this error message, shouldn't it just continue with code execution? – Mate Mrše Feb 19 '18 at 9:12
1

Your element seems to be present, but unreachable.

Use verifyElementClickable(...) instead of verifyElementPresent(...)

Documentation:

Reference Document

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.