declareted variables as a target


#1

I am using
Katalon Recorder with Chrome 67 to automate website testing.

In
user-extension.js we declare a few variables:

storedVars[“neo_ls”] = “system”;

storedVars[“neo_user_pass”] = “pass123”;

storedVars[“date1_selection”]
= “ctl00_ctl00_ContentBodyBase_ContentBody_TabContainerCalendars”;

now in test
case I type first two values into input fields and try to click using 3rd variable
as a click target:

Typing
values – works OK.

But for ‘click’
I get a series of 100(?) 'expand variable … into … ’ messages in execution log
and then failure to find the element:

What is the
correct method of specifying click target using a variable?

(If I substitute
variable ${date_selection} with literal string, target name, click is executed
correctly)

1.png

2.png

3.png


#2

I can’t answer your question but concur with your findings.
It appears that accessor commands support variables but locator commands do not.
e.g
Command ¦ Target
Click ¦ id=$(myVar1)

is not functioning.
I have also tried enclosing the variable in quotation marks (without any hopeful expectation of it working) and it failed.

I think there would be many use cases for requiring variable driven targets. e.g. creation of new elements which subsequently need to be clicked. the only way to target them is by an attribute/locator ID, Name, Xpath. When the ID is created from a variable, the click function needs to accept the variable.


#3

This is now working for me. for the locator, i store it’s HTML id addtribute value in the comma seperated csv file. Add the csv file to katalon recorder (readd it for any changes made to the csv file). In my csv file I have for example:
LoginSurname, Login Forename
Watson, John

in Recorder,
Command Target Value
loadvars nameOYourAddedCSVfile
Click id=${LoginSurname}

the first step will load your variables into Recorder script runtime memory
the second step will perform a click command on the element with an id of LoginSurname
be careful with Synthax, the above is correct afaik. best regards, Brendan