How to test if the variable is not defined?


Hi :slight_smile:

I am trying to test if a variable is defined for not so that I can show a notification that the information is not in the webpage.

I tried including and not including “” and changing the number of equal signs, but I cannot figure out how it should work. Every time, I get [error] variable “TESTEMAIL” is not defined. Can anybody help me on this?

Thank you for reading this topic. Have a good day!


In almost every scripting language you have to define a variable before using it. And it is the same for kantu macros, which are based on a selenium-style syntax.

The way I solved the “check if something was extracted” question is like this:

  • store | XXXXX | testemail (define variable and fill it with dummy value)
  • store | true| !errorignore (continue if nothing is found, just like in your macro)
  • storetext | locator | testemail (extraction is happening here… if locator is found on page)
  • if | "${testmail}" == "XXXXX" | … then throw error “no email found”


Hi @ulrich. That solves the problem and does exactly i wanted to do. I was struggling for this for quite long time. Thank you so much for easy and detailed explanation. Have a nice day :slight_smile: