In this case, global variable exists and has correct value.
But, as soon as you omit openBrowser keyword and run the test using existing instance, global variables are not initialized and it is null.
By omitting openBrowser, do you mean do use DriverFactory.getWebDriver() to retrieve the current running instance but yet the global variables are not initialized ?
I mean running test on existing instance in GUI menu.
By the way, that’s another problem. It is also not able to use DriverFactory.getWebDriver() when you don’t openBrowser() in current scope. Is it possible to find all running WebDriver’s instances created by KS?
did you run the code on existing instance? There are two cases for running test without opened browser, you can click Run or Run on existing browser. See:
Run the following script with default browser Chrome
WebUI.openBrowser(null)
println 'test global variable: ’ + GlobalVariable.Test
At this step, Chrome browser will be launched. Leave it opened
Omit openBrowser as following: //WebUI.openBrowser(null)
println 'test global variable: ’ + GlobalVariable.Test
Click arrow icon next to Run button -> select Chrome (default) -> (blank)
At this step, global variable is still initialized and print its value to Console tab
Run arrow icon next to Run button again -> select Chrome (default) -> New Session
At this step, global variable is still initialized and print its value to Console tab
Did you install Katalon recently and that was version 6.2.1 right away OR you updated the version at least once? It looks this issue happens after any version update…
If you use default execution profile, it works correctly in all cases.
But if you have custom profile, initialization fails for existing browser’s instance.
@Marek_Melocik
when you open initiliay the browser instance you use also the custom profile? or the default one?
just for clarification, i am away from the pc with katalon so i cannot test your issue yet …
could be that somehow, between the runs, katalon forget about what was the selected profile
meah … i thought so. somehow is forgeting about and in the second run may attempt to use the default … i think i was hit once before by similar issue, thought it was fixed