07-09-23 12:02 PM
(Hypothetical Question) Blue prism application modeler - XPATH having a div tag whose value changes from 1 to 50. How can I spy this element? .
A: Can we use the wildcard action in application modeler for the Xpath to identify this element.
07-09-23 12:42 PM
HI Abhi,
Can you please explain in detail for the better understanding in order to provide correct solution.
Note: Please explain along with the screen shot.
07-09-23 12:59 PM
Hi Abhi,
If it's a single element that you're looking for then you can make use of wildcard in the place where you have that change of number. If it's a table structure and if you want all the values to be read then using a counter you can read individual row and append into a collection at the process level.
07-09-23 03:43 PM
Hi Abhi,
The statement is correct, but it is advisable and important to try to identify the element using other attributes such as class name, ID, or other unique identifiers that do not change dynamically, whenever possible.
08-09-23 12:30 AM
HI Abhi Sachdev,
If you have 50 fields and only difference is div tag value like you mentioned 1 to 50. BOT will try to identify 50 fieds and throw exception indicate more than one element identified(It all depends on the website you are trying generally speaking this is how it works, but it depends on how UI built)
If you use the combination of Wildcard in xpath and Match index value as 1 it will identify the first value no matter what.
As other members mentioned its recommended to identify using other attributes.
19-09-23 01:50 PM
You can always use XPath Expressions (XPath 1.0) in your Web Path/XPath to locate elements that change dynamically. By using a relative element, you can find elements that have no unique attributes from other elements and that may move around the page.
Take for instance your Thread on this community's Thread list. It's very easy to find the subject of the thread but it is not so easy to find the element that holds the number of replies to the thread. There is no unique attributes of the "number of replies" element. But you can zero into it by using the following XPath expression:
(//a[starts-with(@title,'(Hypothetical)')]/following::span[starts-with(@aria-label,'Replies,')])[1]
What the XPath expression does is finds the first anchor element with a title attribute that starts with "(Hypothetical)" and then finds the first span element where the aria-label attribute starts with "Replies" that follows that anchor element.
Blue Prism works beautifully with XPath Expressions and all our developers now use XPath Expressions on every Chrome or Edge project.
The added benefit to using XPath Expressions is that you can easily write them and test them using the DevTools in Chrome and Edge. You can see for yourself by: