I have a test listener
def sampleBeforeTestSuite(TestSuiteContext testSuiteContext) {
println testSuiteContext.getTestSuiteId()
println("Opening browser")
WebUI.openBrowser(GlobalVariable.url);
....
This opens the browser to the url…
Then a test suite that calls some tests the tests all look like this:
import ...
WebUI.verifyElementPresent(findTestObject('Object Repository/Home Page Header Objects/HomePageMenuItem Departments'), 1, FailureHandling.STOP_ON_FAILURE)
WebUI.verifyElementClickable(findTestObject('Object Repository/Home Page Header Objects/HomePageMenuItem Departments'), FailureHandling.STOP_ON_FAILURE)
These crash with the error message:
Unable to verify object is present (Root cause: java.lang.IllegalArgumentException: Object is null)
On the first line. I am assuming that the WebUI object is null… however I did rename the folder “Home Page Header Objects” from something like Page_123123123123 ← assuming that this is not a variable here.
Did you change the folder name in Windows Explorer or Katalon?
Check manually if the object is present inside of ‘Object Repository/Home Page Header Objects’ or
‘Object Repository/Page_123123123123’ folder in your file system.
Mate Mrse said:
Did you change the folder name in Windows Explorer or Katalon?
Katalon
Check manually if the object is present inside of ‘Object Repository/Home Page Header Objects’ or
‘Object Repository/Page_123123123123’ folder in your file system.
The folder is correct, I should not have mentioned it at all. It was just an unknown.
It seems to me that there is no reason to believe that the WebUI object’s browser in one code [test listener / Test case] is anyhow related to another. If in the test script I opened the browser it would work. Perhaps the browser should be opened at the test suite example however that is not how the demo works. I’m following GitHub - katalon-studio-samples/katalon-studio-demos: This is demo project on how to use Katalon Studio for Automation Testing as an example.
Okay this seems to be my fault. I did some copy and pasting on the Object name which had a slight misspelling. Totally my fault.