cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic Attribute, with Wildcards

MichaelBerg_And
Level 3

Hi all,

I am currently building an integration where the usage of Dynamic Attributes with wildcards would be a huge help. 

Is there any way to achieve this?

For example:

The Window Text of a specific window can be:

"Create - Customer", "Create - Product", "Modify - Customer", "Modify - Product" and so on.

If I could provide "Create*" or "Modify*", through the Dynamic input, that would solve the issue - But I cant seem to find a way to trigger the wildcard search, through the dynamic input.


I do have other solutions in mind, but this would be the easiest and cleanest, if possible.



------------------------------
Michael Berg Andreasen
RPA Developer
SE
Europe/Denmark
------------------------------
18 REPLIES 18

Hi @devneetmohanty07,

Thank you for the reply .

I am attaching you the rows which I should catch(There may be one 1 row ,3,9 rows etc . )

21049.pngI should go in each row and catch its value (for example row 1 has the value 4701019030).
Below I am attaching you the screenshots of "Inspect elements" for some rows.
21050.png
21051.png
21053.png
21055.png
I will be waiting for your response.
Best regards,
Erjola


------------------------------
Erjola Mema
------------------------------

Honestly, @devneetmohanty07 had a great suggestion with using XPath. ​In theory, it should be both quick and robust.

Before that was a truly viable option in the platform, I had previously written some other automations that would loop upward through a range of div indices until it found a matching container, then used that as an offset going forward.

For example.
Path (dynamic): HTML(1)/BODY(1)/DIV(3)/DIV(2)/DIV([count])/TABLE(1)

Logic:
  1. Use a wait stage with a 0.1s timeout to run a Check Exists against the dynamic element
    1. Timeout
      1. [count] = [count]+1
      2. Return to wait stage to retry
    2. Element found
      1. Proceed with process


------------------------------
Ami Barrett
Solution Architect
Karsun Solutions
Plano TX
------------------------------

Hi @ErjolaMema,

If you can also show the table tag above, it that would be helpful. From what you showed me, seems like you have a table, and you want to catch the values within each of the td tag corresponding to the cells of different rows but for the same column.​


Problem Statement:

In my example, let's say I have a requirement where I need to extract only the cell value for each of the cells in the first column which is called as 'Name' as shown below:

21074.png
In your case you too have a similar requirement where you want to extract the values for each cell with the column header as 'Conto'


Solution Explanation:

If, you see the HTML structure, on a very high level, we have a table tag with an id attribute called as 'example' which consists of a thead and a tbody section as shown below:

21075.png

Now if I see thead section, it has all my header cells denoted within separate th tag here: 

21076.png

And similarly, my tbody tag will have different rows denoted by tr tag within which each cell will be denoted by td tag:

21077.png

So the XPath Expression that I am going to build for this use case would be something like this:

//table[@id='example']//tbody/tr[1]/td[1]

What it means essentially in layman's term is go the table tag with the id attribute as 'example' first. Once you find it, go inside the table for the tbody tag and within that aim for row number 1 which denoted by tr[1] and column number 1 which is denoted by td[1]

This XPath would always aim to 1st row and 1 column value as shown below:

21078.png
Now if let say I want to make it a bit more robust such as I give the name of the column and it automatically provides the value irrespective of the position of the column, my tweaked XPath expression would become: //table[@id='example']//tbody/tr[1]/td[count(//table/thead/tr/th[.="Name"]/preceding-sibling::th)+1]


Here instead of td[1] I wrote td[count(//table/thead/tr/th[.="Name"]/preceding-sibling::th)+1] which means find one position ahead of the position of the td tag which corresponds to the column defined just before the column having the header title as 'Name' within the thead section of the table.  

What this does is it makes your XPath expression dynamic, and it won't rely on column position. Now to finally complete our XPath query we would make the expression dynamic in such a way that we can keep looping a counter variable within it for the tr tag as we are right now pointing the expression to first row using tr[1].

So, we make the attribute dynamic in nature and we use the following expression in a read stage: 

21079.png

The final expression becomes: 

"//table[@id='example']//tbody/tr["& [row counter] &"]/td[count(//table/thead/tr/th[.=""Name""]/preceding-sibling::th)+1]"


21080.png


Final Solution:

So you can use the following modified final expression which I have simplified even further than what I used for my explanation. The only condition is that your table must have a th tag with the name as 'Conto' and a data item called row counter which start from 1 and keeps incrementing till it encounters an error to exit:

"//table[@id='example']//tr["& [row counter] &"]/td[count(//table//th[.=""Conto""]/preceding-sibling::th)+1]"


Also, the best thing about this is if you are able to provide an attribute to the table tag which is 'id' in my case then you probably don't even need to worry about the DIV tags behind it as it will straightaway search from table table ignoring the DIV tag values which you were facing initially.

NOTE: Remember to change the table id tag here from example to what you have. If you don't have id attribute look for a unique attribute and replace both id attribute with that and its value as well



------------------------------
----------------------------------
Hope it helps you out and if my solution resolves your query, then please mark it as the 'Best Answer' so that the others members in the community having similar problem statement can track the answer easily in future

Regards,
Devneet Mohanty
Intelligent Process Automation Consultant | Sr. Consultant - Automation Developer,
WonderBotz India Pvt. Ltd.
Blue Prism Community MVP | Blue Prism 7x Certified Professional
Website: https://devneet.github.io/
Email: devneetmohanty07@gmail.com

----------------------------------
------------------------------
---------------------------------------------------------------------------------------------------------------------------------------
Hope this helps you out and if so, please mark the current thread as the 'Answer', so others can refer to the same for reference in future.
Regards,
Devneet Mohanty,
SS&C Blueprism Community MVP 2024,
Automation Architect,
Wonderbotz India Pvt. Ltd.

Hi Devneet ,

Thank you very much for the reply.
Attached is the table :

21092.png
So, What do I have to put in the 'Id' ?
Is there a change that I should do ?
Thank you again ,
Erjola


------------------------------
Erjola Mema
------------------------------

Hi Devneet ,

The other thing is that I have it only Web Path ,not also the X Path .

Is it a problem?

21115.png


------------------------------
Erjola Mema
------------------------------

Hi @AmiBarrett,

I don't have the Xpath in it .

Is there any other way for a solution ?



------------------------------
Erjola Mema
------------------------------

Hi Erjola,

You have to provide the XPath expression in that Web Path attribute​ only. It accepts both XPaths and full path expressions.

Also, can you show me the HTML for the <table> tag by using inspect element as you did before for <td> tag.

It is impossible to say what the ID would be as you have only shown the screenshot of the table not the HTML code behind it.​​​

------------------------------
----------------------------------
Hope it helps you out and if my solution resolves your query, then please mark it as the 'Best Answer' so that the others members in the community having similar problem statement can track the answer easily in future

Regards,
Devneet Mohanty
Intelligent Process Automation Consultant | Sr. Consultant - Automation Developer,
WonderBotz India Pvt. Ltd.
Blue Prism Community MVP | Blue Prism 7x Certified Professional
Website: https://devneet.github.io/
Email: devneetmohanty07@gmail.com

----------------------------------
------------------------------
---------------------------------------------------------------------------------------------------------------------------------------
Hope this helps you out and if so, please mark the current thread as the 'Answer', so others can refer to the same for reference in future.
Regards,
Devneet Mohanty,
SS&C Blueprism Community MVP 2024,
Automation Architect,
Wonderbotz India Pvt. Ltd.

Hello @ErjolaMema - Here is the answer for your issue on why you can not see the Xpath option. 

Source of below snapshot -
https://blue-prism.docebosaas.com/learn/course/16924/play/37103/Spying%2BUsing%2BCSS%2BSelector%2Band%2BXPath%2B%25E2%2580%2593%2BBasics


21180.png

------------------------------
Neeraj Kumar
Technical Architect
------------------------------

If you don't have XPath, the logic in my previous post should get you there.

------------------------------
Ami Barrett
Solution Architect
Karsun Solutions
Plano TX
------------------------------