# Katalon Recorder global variables

**URL:** <https://forum.katalon.com/t/katalon-recorder-global-variables/12099>\
**Category:** Web Testing\
**Tags:** katalon-recorder\
**Created:** [July 17, 2018, 9:56pm UTC](https://forum.katalon.com/t/katalon-recorder-global-variables/12099 "2018-07-17T21:56:07Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fernando\_Espinoza](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/fernando_espinoza/32/539_2.png) [@Fernando\_Espinoza](https://forum.katalon.com/u/Fernando_Espinoza)\
**Post date:** [July 17, 2018, 9:56pm UTC](https://forum.katalon.com/t/katalon-recorder-global-variables/12099/1 "2018-07-17T21:56:07Z")

</div>

**how to use global variables in katalon recorder (selenium) to use the value of the variables in different tests ?**

---

<div class="post-metadata">

**Author:** ![Arnel](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/arnel/32/6360_2.png) [@Arnel](https://forum.katalon.com/u/Arnel)\
**Post date:** [July 23, 2018, 4:45am UTC](https://forum.katalon.com/t/katalon-recorder-global-variables/12099/2 "2018-07-23T04:45:53Z")

</div>

Hi Fernando,

I don’t think Katalon recorder supports global variables. Recorder only supports basic test cases. You can only use local variables. If you really want to use global variables, you should use the Katalon studio.

Thanks.

---

<div class="post-metadata">

**Author:** ![Fernando\_Espinoza](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/fernando_espinoza/32/539_2.png) [@Fernando\_Espinoza](https://forum.katalon.com/u/Fernando_Espinoza)\
**Post date:** [July 23, 2018, 6:24pm UTC](https://forum.katalon.com/t/katalon-recorder-global-variables/12099/3 "2018-07-23T18:24:50Z")

</div>

I’ve  
already solved the problem, if you can use global variables in katalon  
recorder, when you have some time I’ll think about how to do it.

---

<div class="post-metadata">

**Author:** ![Fernando\_Espinoza](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/fernando_espinoza/32/539_2.png) [@Fernando\_Espinoza](https://forum.katalon.com/u/Fernando_Espinoza)\
**Post date:** [August 3, 2018, 4:24pm UTC](https://forum.katalon.com/t/katalon-recorder-global-variables/12099/4 "2018-08-03T16:24:43Z")

</div>

I solved this problem by creating a javascript file that contains the global varaible and then I save it in katalon recorder, I create a camando to invoke the varaible. that’s how it works 🙂

---

<div class="post-metadata">

**Author:** ![Piotr](https://avatars.discourse-cdn.com/v4/letter/p/839c29/32.png) [@Piotr](https://forum.katalon.com/u/Piotr)\
**Post date:** [January 9, 2019, 8:59am UTC](https://forum.katalon.com/t/katalon-recorder-global-variables/12099/5 "2019-01-09T08:59:29Z")

</div>

Can you share that code with us? 🙂  
It is possible to use csv file as well to have a global variables.

---

<div class="post-metadata">

**Author:** ![ThanhTo](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/thanhto/32/697_2.png) [@ThanhTo](https://forum.katalon.com/u/ThanhTo)\
**Post date:** [January 9, 2019, 10:01am UTC](https://forum.katalon.com/t/katalon-recorder-global-variables/12099/6 "2019-01-09T10:01:12Z")

</div>

Hi @Fernando_Espinoza, it would be nice if you can share your solution as a tips-and-tricks post of sorts for users who are encountering the same problem. Or you can share your solution in more details here and we will compile into a tips-and-tricks post ourselves !

Good day !

---

<div class="post-metadata">

**Author:** ![Fernando\_Espinoza](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/fernando_espinoza/32/539_2.png) [@Fernando\_Espinoza](https://forum.katalon.com/u/Fernando_Espinoza)\
**Post date:** [January 9, 2019, 2:46pm UTC](https://forum.katalon.com/t/katalon-recorder-global-variables/12099/7 "2019-01-09T14:46:10Z")

</div>

Hi, of course if you shortly share a snippet of code and how it works.

---

<div class="post-metadata">

**Author:** ![Mark\_Gibson](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/mark_gibson/32/1143_2.png) [@Mark\_Gibson](https://forum.katalon.com/u/Mark_Gibson)\
**Post date:** [January 15, 2019, 9:42am UTC](https://forum.katalon.com/t/katalon-recorder-global-variables/12099/8 "2019-01-15T09:42:01Z")

</div>

You can use the **store** command as explained [here](http://www.software-testing-tutorials-automation.com/2012/11/store-and-echo-command-in-selenium-ide.html)

**Command** : store  
**Target** : The Value to store e.g. Hello World  
**Value** : The name of the variable to store the value e.g. MyVar

You can view the value of the variable in the **Log** by using the **echo** command  
**Command** : echo  
**Target** : ${The name of the variable to output} e.g. ${MyVar}

You can also see the variables and their values by viewing the **Variables** tab on the recorder.

You can then use the variable in other tests e.g. setting the value of a text box  
**Command** : type  
**Target** : css=input[type=text]#MyTextBoxID  
**Value** : ${MyVar}

Note that you should probably set up your global variables in the first test of your test suite to ensure the values are available for the other tests.

---

<div class="post-metadata">

**Author:** ![Fernando\_Espinoza](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/fernando_espinoza/32/539_2.png) [@Fernando\_Espinoza](https://forum.katalon.com/u/Fernando_Espinoza)\
**Post date:** [January 15, 2019, 2:25pm UTC](https://forum.katalon.com/t/katalon-recorder-global-variables/12099/9 "2019-01-15T14:25:09Z")

</div>

I create a js file that contains the variables, then I just send the varible

a file user-extensions.js is recreated and it is only uploaded in the interface of katalon ide  
the file contains the following code for example:

storedVars [“varName”] = “”;  
storedVars [“varPass”] = “”;  
storedVars [“varBanOw”] = “”;  
storedVars [“varPassOw”] = 123 + 5;

Then you get the value of the varible as follows:  
Command: click  
Target: css = input [type = text] #MyTextBoxID  
Value: $ {varName}
