Question

6
Replies
72
Views
Close popover
William Tran (wtran)
Cathay Bank
RPA Developer
Cathay Bank
US
wtran Member since 2019 5 posts
Cathay Bank
Posted: September 16, 2020
Last activity: September 17, 2020

How do we use the ForLoop object to loop through a dynamic website that is not an HTML table?

Currently, there is a tree navigation that was interrogated on the site that I would like to loop through. There is a Div with a class called "tree" and under this Div, there are multiple Divs with the class called "treerow". I have created a container for the Div with class "tree" and want to loop through "treerow". There is not a set number of "treerow" divs that will populate. For each of the "treerow", the plan is to grab the value of the span element so I could do a value comparison. What would an example of this automation look like in Pega Robotics?

Here is an example below:

<div class="tree">
   <span class="treeRow">
       <span fieldname="uniqueField1">Item 1</span>
   </span>
   <span>
     <div class="treeRow">
       <span fieldname="uniqueField2">Item 2</span>
       <span class="treeBranch">
         <div class="treeRow">
           <span fieldname="fieldA">Item 3</span>
           <span class="treeBranch"></span>
         </div>
         <div class="treeRow">
           <span fieldname="fieldB">Item 4</span>
           <span class="treeBranch"></span>
         </div>
       </span>
     </div>
   </span>
</div>

 

So within this div class "tree", the 1st span has the class "treeRow". I am trying to get to the 2nd span that does not have a class but within this span, there is a div class "treeRow". Then loop within the span class "treeBranch", I am trying to loop through each div class "treeRow" and get the value of the span that has a unique fieldname attribute. In this case, I would be looping to get the values - "Item 3" and "Item 4". Keep in mind that the "treeRows" within this "treeBranch" is dynamic so in some cases, the number of "treeRows" would change within this "treeBranch". The setup of this site is complicated and any help is greatly appreciated.

 

Pega Robotic Process Automation 19.1 Robotic Process Automation