Can I use a variable in web URL string

Can anyone assist in how I go about creating a variable for a web URL:

I would like my Url to identify a variable in the URL I will use the following URL as an example:

Current - Categories - Katalon Community
Variable option -${id} so the variable should be id so that I can use data to drive which page should open

Is this possible and how?


  1. Choose (or create a new) profile: Tests Explorer > Profiles

  2. Create a variable: myVariable

  3. Give the variable a value: myvalue

  4. Use the variable in a Test Case:

WebUI.navigateToUrl('' + GlobalVariable.myVariable)

Thank you, you are a legend…
It works great perfect :+1:t2:

1 Like


I’m getting the basics working but not the complex query

So in the example below I need the GlobalVariable to be in the middle of the URL
can this be done?

WebUI.navigateToUrl(' + GlobalVariable.myVariable/register/new)


In essence, you’re asking how to concatenate strings in Groovy script.

String myString = "mainj" + myVariable + "russ" + otherVariable + "Katalon"

Yes and No:
So the Idea as per my original post was to use a GlobalVariable in my Web URL
Which when I use. Example
WebUI.navigateToUrl(‘ GlobalVariable.myVariable)
it works happy

However I want to push this further so that when I navigate to the URL the variable is in the middle of the URL
WebUI.navigateToUrl('http://work.coms/login/user/ 988asd09-09asda2i9as/

The key 988asd09-09asda2i9as must come from a variable as this can change with new sessions

I have tried using concatenate but have failed :disappointed:


WebUI.navigateToUrl("http://work.coms/login/user/" + GlobalVariable.myVariable + "/")
1 Like

Thank You
I Realized my mistake.

You can use also string interpolation if concatenation is confusing: