Ask a Question

How to check for a row value for paginated records ?

gk1970
Occasional Contributor

How to check for a row value for paginated records ?

Hi,

I have a need to find out the status of an invoices generated dynamically.I am able to find the invoice number/status for a fixed set of records(in my case 10/page).So my question is for pagination how will I find the concerned  link and go to the page for a particular invoice # and find the status. I am testing pages of Oracle EBS.



Thanks,

Girish
Girish
27 REPLIES 27
YMinaev
Staff

Hi,



You need to move through pages (click the link/button/whatever which moves you to the next page) and use the Find method on each page to find your invoice by its number. Once Find returns an object with Exists equal to True, work with this object.
------
Yuri
TestComplete Customer Care Engineer

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
gk1970
Occasional Contributor

Thanks Jared. Please have a look at the following code,I am able to compare Invoice# as text and I need to click the link coming in some other cell corresponding to that row, which I am ..

PropArray = Array("Link")

 ValuesArray = Array("500.00")

  ' Specifies the property values

     'ValuesArray(0) = "Link"

       'ValuesArray(1) = "500.00"

 

          Set obj = pagefn.Find(PropArray, ValuesArray, 20000)



I guess the depth is 20,000,I mean to take that going thro' all the child objects.obj.Exists ,but returns false.



Am I missing something here ?
Girish
YMinaev
Staff

Hi,



Is the link you want to click located in the same table row as the invoice#? If it is, just obtain the corresponding row cell as it is described in the "Parsing HTML Tables" help topic.
------
Yuri
TestComplete Customer Care Engineer

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
gk1970
Occasional Contributor

That's done Jared .Thanks But if I want to click the pagination links,that's also working,but once I reference the table object to try &  get the rows and cells ,VBScript error 'Unspecified Error' comes up.I checked exists property,returns true ,but rows.length is throwing the 'Unspecified error exception'.Please review the function below  for your review.I use this function to loop thro,after getting page and table.First page is ok,if data is not there,it clicks the Next pagination link,from there the above error related to tableobj appears



Function LoopCells(tableobj,matchtext)



          if        tableobj.exists  Then

             Log.Message("tableobj exists ")

             Log.Message(tableobj.rows.length) ' This gives error

          end if



       For i = 1 To tableobj.RowCount-1

          

          'Sys.Process("iexplore").Page("*").Form("DefaultFormName").Panel(0).Panel(2).Panel(0).Panel(1).Table("SearchHdr").Cell(3, 0).Table(0).Cell(0, 0).Panel(0).Panel(0).Table(2).rows.item(i).cells.length

          Set row=tableobj.rows.item(i)  

          'MsgBox(tableobj.rows.item(i).cells.length)

          For j = 0 To Row.cells.length - 1

            ' get the cell

            Set cell = row.cells.item(j)

              

                      Log.Message "Cell " + ": " + Cell.innerText

                      if (Cell.innerText=matchtext) Then

                      Result = CBool(1 + 1 = 2)

                      LoopCells=Result

                      exit function

                      else

                        Result = CBool(1 + 1 = 5)

                        LoopCells=Result

                      end if

    Next

       Next

      

End Function
Girish
YMinaev
Staff

Hi,



Can you post here an image of this exception? In which exact line does it occur?
------
Yuri
TestComplete Customer Care Engineer

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
gk1970
Occasional Contributor

With ref. to what I said ".I
use this function to loop thro,after getting page and table.First page
is ok,if data is not there,it clicks the Next pagination link,from
there the above error related to tableobj appears"

I did the mistake of getting the page and table and referencing it same when I move to the next page ,so I am checking whether data I want exists after getting again the page and table,I also do a wait and refresh of the page(going by one of your recommendations in a post).

My thought process is ,if the table is not created dynamically(html source doesn't show that),why would one need to create the page and table again to reference the same.Looks like the object is destroyed when it goes to the next page .Just wanted to check this is correct?



And one more thing.. I am trying to write a generic function ,based on data to be found ,it would go thro' paginated records and initiate a click action either on a button/link which can be on any cell on a row.

How do I get that ,unless otherwise I pull up the type specified in an excel? Can this be done like get the cells in that row,based on excel value,then  either click the link/button ?Just get the excel value and use Link() /  Button() ??
Girish
YMinaev
Staff

Hi,



Looks like the object is destroyed when it goes to the next page .Just wanted to check this is correct?


Yes, this happens because the page is reloaded.



I am trying to write a generic function ,based on data to be found


Use the Find method, search by text.
------
Yuri
TestComplete Customer Care Engineer

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
gk1970
Occasional Contributor

Thanks Jared,Can you post a small code sample/link to a sample ?Because I am not sure of the properties/values to be passed in Find method for link/button.For button,object finder reveals a Image.Is there a way to get the objectType ? I saw the objectType in ObjectTree .


Girish
YMinaev
Staff

Hi,



To get the object type, use the objectType property. As for finding links and buttons, you can try using innerText to address them by captions without using object types at all. This way, you can create code which will click any object with the specified text.
------
Yuri
TestComplete Customer Care Engineer

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
cancel
Showing results for 
Search instead for 
Did you mean: