Global variables are not initialized when using existing WebDriver's instance

Have any global variable (e.g.GlobalVariable.Test)
Run following code:

println GlobalVariable.Test

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.

KS 6.2.1

1 Like

Hi @Marek_Melocik

By omitting openBrowser, do you mean do use DriverFactory.getWebDriver() to retrieve the current running instance but yet the global variables are not initialized ?

Cheers !


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?

@ThanhTo It seems that multiple users are affected by the issue. Could you consider fixing it soon, please?

1 Like

Hi @Marek_Melocik

Thanks for the info, we are currently looking into this issue. Will get back to you there’s something.

Cheers !

1 Like

Hi @Marek_Melocik,
I’ve jus run with 6.2.1 and it’s okay. Global variable is initialized correctly.

Hello @Loan_Tran

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:


Sure, Marek. Here are my steps:

  1. Run the following script with default browser Chrome
    println 'test global variable: ’ + GlobalVariable.Test
    At this step, Chrome browser will be launched. Leave it opened
  2. Omit openBrowser as following:
    println 'test global variable: ’ + GlobalVariable.Test
  3. 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
  4. 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

That’s weird - I followed the same steps. Number 3 fails for me.

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…

I’ve just updated from 6.2.1 to the latest one 6.2.2 and verified the issue again but the global variable is still printed to Console tab

@Loan_Tran Ok I think I know where the issue is.

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.

Hope this helps you with fix.

1 Like

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

Always custom 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

Thanks for your information. I can reproduce the issue now. I’ll submit a new ticket for the team to get it fixed.

1 Like

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