How to use Test Case Variables in JavaScript

Does anyone know the syntax for using variables defined in the variables tab inside execute javascript?

I moved your question to a new topic.

image

3 Likes

Thank you Russ! So it seems that JS must first be completely moved over to string in order for this to work. Previous approaches of trying to write variables within the execute javascript scope would fail otherwise. Gotcha!

1 Like

Yes. Note the TRIPLE DOUBLE quotes: namely a GString (Groovy-string, not a wispy feminine garment :wink: ) These allow the ${thing} placeholder syntax AND multiline code. You can also use TRIPLE SINGLE quotes for just multiline but no placeholders are allowed.

In esscence, it’s executeJavaScript(string, argsArray)

1 Like