question

xmac avatar image
xmac asked xmac commented

xPath target showing error.

Im trying to click on a xpath target with a variable substition on it. but iTest is showing error while I type it in the code. Refer the screenshot below ![![alt text][1]][1] [1]: /storage/temp/4292-htmlerror.png
iTestxpathVariables
htmlerror.png (3.7 KiB)
htmlerror.png (3.7 KiB)
10 |950

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
JeffJ avatar image
JeffJ answered xmac commented
The error is coming from the square brackets. To the iTest interpreter, square brackets are a precedence setting operation. Basically you're telling the iTest interpreter to evaluate "5" and "2" before doing anything else on the line. If you use this syntax, you need to escape the open and close square brackets like you did for the "\[$r\]". I'd also suggest that if you need to do substitution like this, you investigate using form maps. This will make this effort much easier and you'll have a more readable test script in the end.
1 comment
10 |950

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

xmac avatar image xmac commented ·
Thanks. Its fine now. Can you give me more on form maps ? I know how to use form maps for creating target and use it in script. But I dont know how to deal with form maps when you have substituions. Please can you give me some idea or reference on that.
0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.