WebUI.verifyElementVisible(TestObject o) and WebUI.verifyElementPresent(TestObject o) should return false when element is not visible nor present but instead it just stop the whole process with the not found message.
For example:
if (WebUI.verifyElementVisible(findTestObject(‘button_Add’))) {
WebUI.click(findTestObject(‘button_Add’))
}
The condition is not true so false should be returned which means clicking should be skipped but instead it dies once it hits the conditional statement (the if statement). Same thing happens when use the verifyElementPresent() method.
There are two verifyElementVisible methods. I used the one with one argument. There’s another one with two arguments. The one you showed me has three arguments.
I tried the second method but same thing happened. Here’s the output.
Test Cases FAILED because (of) Unable to verify object ‘Object Repository/button_Add’ is visible (Root cause: Web element with id: ‘Object Repository/Repository/button_Add’ located by ‘By.xpath: //button[@type = ‘button’ and @name = ‘ctl00$cphBody$radBillHistory$ctl00$ctl06$ctl00’ and @id = ‘ctl00_cphBody_radBillHistory_ctl00_ctl06_ctl00’ and (text() = ‘Add’ or . = ‘Add’)]’ not found)
What’s funny is that this method should return a boolean but instead it just kill the process and stop the test all together.
I also have a feeling that the document is not up to date. The two verifyElementVisibles are as follow:
WebUI.verifyElementVisible(TestObject o)
WebUI.verifyElementVisible(TestObject o, FailureHandling flowControl)
I tried the second method but same thing happened. Here’s the output.
Test Cases FAILED because (of) Unable to verify object ‘Object Repository/button_Add’ is visible (Root cause: Web element with id: ‘Object Repository/Repository/button_Add’ located by ‘By.xpath: //button[@type = ‘button’ and @name = ‘ctl00$cphBody$radBillHistory$ctl00$ctl06$ctl00’ and @id = ‘ctl00_cphBody_radBillHistory_ctl00_ctl06_ctl00’ and (text() = ‘Add’ or . = ‘Add’)]’ not found)
What’s funny is that this method should return a boolean but instead it just kill the process and stop the test all together.
Set the FailureHandling.OPTIONAL, otherwise Katalon will mark that step as failed and stop the execution.
So I guess “,” is now part of the string. It is no longer a separator. I tried to create a list of String and I believe the syntax is String list = [’’, ‘’, ‘’, …]
I tried to create a list of String and I believe the syntax is String list = [‘’, ‘’, ‘’, …]
No, your understanding is wrong.
If you want to create a List of String in Groovy, you should write:
List<String> list = ['a','b','c']
If you want to create an array of String in Groovy, you should write:
String[] array = ['a','b','c'] as String[]
On the right-hand side of the statement, you are converting a List to String.
When you write a statement:
String list = ['a', 'b', 'c']
The right-hand side is a List. But on the left-hand side you are saying you want a String named list. So the Groovy language implicitly convert the List object to a String object. Groovy does not throw an error here as Java does. This difference comes from the language design. So you will get a String variable with value of