cancel
Showing results for 
Search instead for 
Did you mean: 
maserpa
Level 2
Status: New
I noticed when attempting to use XPath to match multiple values, and then iterate through each using Match index does not work.  For example, if I use the following XPath to find multiple matches on a page in Chrome, I can iterate through each using Chrome dev tools:
//div[boolean(number(substring-after(@id,"{ID HERE}-"))) or number(substring-after(@id,"{ID HERE}-")) = 0]
 
In Blue Prism App Modeler, I was expecting for it to build an indexed list of all matches, and then be able to use Match Index to iterate through them.  Unfortunately, this does not function this way; instead, it only returns the first match.
 
Having this capability - similar to using the same xpath in Chrome dev tools - would be better than other options, such as: 
a) Use regex with the web id or class in combination with tag (takes too long for large pages)
b) Wildcard matching with the tag attributes (takes too long for large pages)'
c) Using a dynamic path with an iterator in the object logic (quicker, but also cumbersome for maintenance in come cases depending on complexity)
2 Comments

@maserpa  

You have to do it like this

 

(//div[boolean(number(substring-after(@id,"{ID HERE}-"))) or number(substring-after(@id,"{ID HERE}-")) = 0] )[n]

For match index provide 1

And it will work

RoopkiranBevara
Level 4

Hi @maserpa  ,

Kindly use the Counter (Number data variable) to pass in match index(Attribute) & increase the counter parallelly for reaching your Web page. It will works.

 

Regards,

Roopkiran.