Pagination every 20 loops go next page searching good workaround

Hi,

  • If you’re unknow xpath, please refer Loop action to next elements in page - #2 by Starbucks
  • Simplest solution, change number of records per page to maximum.
  • Understand Data Flow Control using loops: White / For, If / Else / Else if, GotoIf, Break / Continue.
  • Investigate properties of elements (page 1, page 2…) to find the xpath formula

Example: See photo attached.

  • Pagination: 20 records
  • Page 1-> Page end: Locator of Customer Code cell:
    Row 1: xpath=//div[@role=“row” and @row-index=“0” and @aria-rowindex=“3”]/div[@col-id=“cust_code”]/div
    Row 2: Same above with parameters: row-index=“1” and @aria-rowindex=“4”

    Row 20: row-index=“19” and @aria-rowindex=“22”

    The formula is same for page 1–> page 2 → page end…

PSEUDOCODE: Data flow control

i = 0 // define parameter
j = 0
While (true)
{
j = 3 + i;
xLoc = ( xpath= //div[@role=“row” and @row-index=“${i}” and @aria-rowindex=“${j}”]/div[@col-id=“cust_code”]/div )
If (element xLoc presented)
{
Do action…;
i = i + 1; // next row on current page
}
// Each page: maximum 20 records exist: row-index={0,1,…19}. Not present: row-index = 20
Else If (next page button presented)
{
Click next page button; // next page
i = 0; // first row on current page
}
Else Break // last page: exist loop
}

1 Like