Possible bug in times command ${!times} when looping xpath

variable interpolation/parsing issue

times loop variable interpolation truncates XPath expressions containing ${!times}`

  1. UI.Vision RPA version: ( 9.6.1 )
  2. Chrome Browser: Version 150.0.7871.125 (Official Build) (64-bit)
  3. OS: Windows (Windows 10 Pro 22H2)

When using ${!times} inside an XPath locator, the generated XPath is sometimes truncated during execution.

Example intended XPath:

xpath

//*[@id=x‘birthday’]/div/div/span[${!times}]/a/span/b
Expected after substitution
//*[@id=‘birthday’]/div/div/span[3]/a/span/b

Actual behavior observed: after 2nd iteration (iteration 1 works as expected, iteration 2 onward is truncated)

//*[@id=‘birthday’]/div/div/span[3]/a/span (the /b is truncated)

or Command storeAttribute

//*[@id=‘birthday’]/div/div/span[4]/a/span@class
works on 1st iteration becomes truncated on 2nd iteration onward

//*[@id=‘birthday’]/div/div/span[4]/a/span

I switched to the internal loop ${!loop} and the issue went away. The xpaths are not truncated.

When testing I added the xpaths to a variable and then expanded the variables during runtime, however the xpaths were still truncated on the 2nd iterations onward.

Working Code

{
“Name”: “user class-4”,
“CreationDate”: “2026-7-17”,
“Commands”: [
{
“Command”: “store”,
“Target”: “true”,
“Value”: “!errorignore”,
“Description”: “”
},
{
“Command”: “store”,
“Target”: “1”,
“Value”: “!timeout_wait”,
“Description”: “”
},
{
“Command”: “if”,
“Target”: “${!loop} == 1”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “store”,
“Target”: “Happy Birthday!!! :yay:”,
“Value”: “message”,
“Description”: “”
},
{
“Command”: “end”,
“Target”: “”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “comment”,
“Target”: “store // xpath=//[@id=‘birthday’]/div/div/span[${!loop}]/a/span/b",
“Value”: “xpUser”,
“Description”: “”
},
{
“Command”: “storeText”,
“Target”: "xpath=//
[@id=‘birthday’]/div/div/span[${!loop}]/a/span/b”,
“Value”: “xpUser”,
“Description”: “”
},
{
“Command”: “store”,
“Target”: “${xpUser}”,
“Value”: “username”,
“Description”: “”
},
{
“Command”: “executeScript_Sandbox”,
“Target”: “return ${username}.replace(/^“|”$/g,‘’).trim();”,
“Value”: “username”,
“Description”: “”
},
{
“Command”: “store”,
“Target”: “xpath=//[@id=‘birthday’]/div/div/span[${!loop}]/a/span@class",
“Value”: “xpClass”,
“Description”: “”
},
{
“Command”: “storeAttribute”,
“Target”: “${xpClass}”,
“Value”: “userClass”,
“Description”: “”
},
{
“Command”: “executeScript_Sandbox”,
“Target”: “return ${userClass}.replace(/^“|”$/g,‘’).trim();”,
“Value”: “userClass”,
“Description”: “”
},
{
“Command”: “executeScript_Sandbox”,
“Target”: “return ${message} + ’ <> [’ + ${userClass} + ‘_bold]@’ + ${username} + ‘[/’ + ${userClass} + ‘_bold] :yay:’;”,
“Value”: “message”,
“Description”: “”
},
{
“Command”: “echo”,
“Target”: “${message}”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “if”,
“Target”: “${!loop} == 9”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “selectFrame”,
“Target”: “relative=top”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “selectFrame”,
“Target”: “index=0”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “type”,
“Target”: "xpath=//
[@id=‘inputField’]”,
“Value”: “${message}”,
“Description”: “”
},
{
“Command”: “end”,
“Target”: “”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “comment”,
“Target”: “verifyElementPresent // xpath=//*[@id=‘birthday’]/div/div/span[3]/a/span/b”,
“Value”: “”,
“Description”: “”
}
]
}

Echo Message Result (bbCode)

Happy Birthday!!!! :yay: <> [user_bold]@Funkadhafi[/user_bold] :yay: <> [power_user_bold]@kdev7[/power_user_bold] :yay: <> [power_user_bold]@morbiddk[/power_user_bold] :yay: <> [power_user_bold]@papito[/power_user_bold] :yay: <> [elite_user_bold]@Scarecrow[/elite_user_bold] :yay: <> [user_bold]@seventill3[/user_bold] :yay: <> [user_bold]@SexyHick[/user_bold] :yay: <> [user_bold]@Viperions[/user_bold] :yay: <> [power_user_bold]@voox2200[/power_user_bold] :yay:

There are a few other instances where I use “times“ to iterate through xpaths where I get many #LNF returned but I haven’t analyzed those as the results were not critical and the erros were ignored. When I get a chance I’ll check to see if the same behavior is seen.

Summary
in this use case the xpath are getting truncated on the 2nd iterations whether using the raw xpath or by extrapilating the xpaths from a variable. Just curious if this is a bug.

BTW, I still have the nonworking code if you’d like to see that as well.

Thank you.
de Plane