Variable in href test object

Is there a way to use a global variable in a href test object?

Here’s the href:

I need to run my test case and replace the date by a global variable (or another type of variable). I need to use the href and the text to identify the element on the web page. xPath is not unique.


did you try to use “${GlobalVariable.var}” where do yo want to get the value?


G_Date is my global variable.

I tried this in the href value test object:${GlobalVariable.G_Date}&time=18:00

I even tried with double quote:"${GlobalVariable.G_Date}"&time=18:00

I even tried double double quote:""${GlobalVariable.G_Date}""&time=18:00

Single quote:’${GlobalVariable.G_Date}’&time=18:00

Double single quote:’’${GlobalVariable.G_Date}’’&time=18:00

I can see the concat function getting call in some cases. Here’s the log for double single quote:
located by ‘By.xpath: //a[@href = concat(‘’ , "’" , ‘’ , “’” , ‘${GlobalVariable.G_Date}’ , “’” , ‘’ , “’” , ‘&time=18:00’) and (text() = ’

I can’t figure out the right syntax.



Sorry for my bad. We could not use the variable directly now. Here is the solution:
- Specify a variable in the href as below:

- In the test case (calling the rest object), use following script to put Globalvariable into the variable'Page_CuraHomepage/btn_MakeAppointment', [('var1') : GlobalVariable.G_href]))

Hope that it helps.

We also put this issue as an enhancement in our backlog.


This is working. It’s not perfect in my scenario since I only have a part of the href that’s dynamic. But still, it’s working for now.
Perfect feature would be to be able to put a variable inside a href value. Like:
something, $Global.var, somethingelse

I’m sure I read how to build that kind of string in Groovy. If I bump into it again I’ll drop a line here.