How to use a loop index variable to create a dynamic XPath in Process Studio?

Hi team,

I am trying to create a dynamic XPath for web automation in Process Studio. Specifically, I want to use an index from my loop to select elements, for example: //h2[@class='nist-block__title'][i]

I am using the Start Loop plugin. How can I correctly pass the loop iteration variable into the XPath string to make it dynamic for each iteration?

Any guidance on the correct syntax or step configuration would be appreciated!

Hi Pushkraj.

Inside a Loop you should create new variables. This can generate unexpected issues.
You could create a small Javascript inserting the loop index and apply formula if needed.

Suggest Loop initialize with 2 additional variables beside the Loop Index, XPath with base xpath variable and XPath Result (XPath with Index) and use this last one in the required step.

Hope this helps.