Forum Discussion

gk1970's avatar
gk1970
Occasional Contributor
15 years ago

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
  • gk1970's avatar
    gk1970
    Occasional Contributor
    Is there anything I need to explain further ?



    Girish

  • Hi Girish,





    Most probably, the cause of the problem is that you choose an incorrect cell object to find the text. The previous script you sent worked with the 'Cell(6, 2)' object, while the object in the latest images you posted has the 'Cell(7, 2)' name. Since the needed cell can change from time to time, I recommend that you use a higher level parent object to search for the needed link.

    ...

        PropArray = Array("ObjectType", "innerText")

        ValuesArray = Array("Link", "100187")

        

        Set tableObj = Sys.Process("iexplore").Page("*").Form("DefaultFormName").Panel(0).Panel(2).Panel(0).Panel(1).Table(1).Cell(1, 0).Panel(0).Table(0).Cell(3, 0).Table(0).Cell(0, 0).Panel(0).Panel(3).Table(0).Cell(1, 0).Table(0)

        If Not tableObj.Exists Then

          Log.Error "The table object is not found"

          Runner.Stop

        End If

        Set linkObj = tableObj.FindChild(PropArray, ValuesArray, 15)

        

        If linkObj.Exists Then

          Log.Message "The link is found"

        Else

          Log.Error "The link is not found"

        End If

    ...
  • gk1970's avatar
    gk1970
    Occasional Contributor
    Thanks David ! You are right,I indeed did that earlier. As I said earlier we have screens which have paginated records and we need to test whether it performs some operation(it could be clicking on a rdb/link or even status check),so I am trying to create a function which will loop thro' the rows and cells based on inputs ; they are parent  object(i used the higher level object),text to search and possibly the type of object. As a sample I tried to use i/p params as object and matchtext.Surprisingly innerText is not able to match and function returns false,I also tried Title. Reason is I think is evident from attached issue7.jpg.SO which property should I use to  match ?



    ---------------------------------------------------------------------------------

    sub PO35

    Dim iexplore

      Dim page

      Dim table

      Dim passwordBox

      Dim cell

      Dim panel

      Call TestedApps.iexplore.Run(1, True)

      Set iexplore = Sys.Process("iexplore")

      Call iexplore.ToURL("http:/XXXX.org:8006/")

      Set page = iexplore.Page("http://XXXX.org:8006/")

     

      page.Wait

      Set table = page.Form("DefaultFormName").Panel(0).Panel(2).Table("LoginRN").Cell(1, 1).Table("region144").Cell(1, 1).Table("region14")

      table.Cell(0, 2).Table("usernameField_xc_").Cell(0, 2).Textbox("usernameField").Text = "test"

      Set passwordBox = table.Cell(1, 2).Table("passwordField_xc_").Cell(0, 2).PasswordBox("passwordField")

      passwordBox.Text = "oracle"

      Call passwordBox.Keys("[Enter]")

      Call aqUtils.Delay(2000,"Login")

      page.Form("DefaultFormName").Panel(0).Panel(2).Panel(0).Panel(1).Table("topTableLayoutContainer").Cell(0, 0).Table("leftLayoutRN").Cell(1, 0).Table("region1").Cell(3, 0).Table(0).Cell(0, 0).Panel(0).Panel(1).Table(0).Cell(0, 0).Table(0).Cell(1, 3).Link("AppsNavLink").Click

      page.Form("DefaultFormName").Panel(0).Panel(2).Panel(0).Panel(1).Table("topTableLayoutContainer").Cell(0, 0).Table("leftLayoutRN").Cell(1, 0).Table("region1").Cell(3, 0).Table(0).Cell(0, 0).Panel(0).Panel(1).Table(0).Cell(0, 1).Table(0).Cell(2, 2).Link("N61").Click

      Call aqUtils.Delay(5000,"Login")

      Set cell = page.Form("DefaultFormName").Panel(0).Panel(2).Panel(0).Panel(1).Table(1).Cell(1, 0).Panel(0).Table(0).Cell(3, 0).Table(0).Cell(0, 0).Panel(0).Panel(1).Table("customizationsPoplist_xc_").Cell(0, 2)

      Call cell.Select("customizationsPoplist").ClickItem("My Open Orders")

      cell.Button(0).Click



      Set panel = page.Form("DefaultFormName").Panel(0)

       PropArray = Array("ObjectType", "Title")

      ValuesArray = Array("Link", "100187")

     

      if Sys.Process("iexplore").Page("*").Form("DefaultFormName").Panel(0).Panel(2).Panel(0).Panel(1).Table(1).Cell(1, 0).Panel(0).Table(0).Cell(3, 0).Table(0).Cell(0, 0).Panel(0).Panel(3).Table(0).Cell(1, 0).Table(0).RowCount>1 Then

          

             set o=Sys.Process("iexplore").Page("*").Form("DefaultFormName").Panel(0).Panel(2).Panel(0).Panel(1).Table(1).Cell(1, 0).Panel(0).Table(0).Cell(3, 0).Table(0).Cell(0, 0).Panel(0).Panel(3).Table(0).Find(PropArray,ValuesArray, 20000)

             Log.Message(o.ObjectType) ' I 'm able to identify the type

               

          

            set pg=GetPage()

               

             pg.Wait

                'Get table

                

              set tbl=pg.Form("DefaultFormName").Panel(0).Panel(2).Panel(0).Panel(1).Table(1).Cell(1, 0).Panel(0).Table(0).Cell(3, 0).Table(0).Cell(0, 0).Panel(0).Panel(3).Table(0).Cell(1, 0).Table(0)

           

            

              check= LoopCells(tbl,"100187") ' Function



              Log.Message(check)

          

      end if

     

     



      end sub

      Function GetPage()



          Set p = Sys.Process("iexplore")

          Set GetPage =p.Page("*")

          

      End Function

      Function LoopCells(tableobj,matchtext)

               

              if        tableobj.exists  Then

                 Log.Message("tableobj exists ")

                 'log.Message(tableobj.Cell(1, 2).innerText)

                 Else

                     exit function

              end if



           For i = 1 To tableobj.RowCount-1

                

              For j = 0 To tableobj.ColumnCount(i)-1

                    

                    Set Cell = tableobj.Cell(i, j)

                    'Log.Message(Cell.ObjectType)  'Returns Null .

                    if j=2 then

                    'Log.Message ("Cell " & j & ": " & Cell.innerText & " row :" & i)

                    Log.Message(Cell.ObjectType)

                    Log.Message ("Cell " & j & ": " & Cell.innerText & " row :" & i)

                    end if

                  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

  • Hi Girish,





    I still do not understand why you are iterating through rows and cells instead of using the Find method.





    If you need to find a table row containing a link with some specific text to operate on an object of this row, you can first find the link and then get the index of the corresponding row using this link object.

        PropArray = Array("ObjectType", "innerText")

        ValuesArray = Array("Link", "100187")

    ...

        Set linkObj = tableObj.FindChild(PropArray, ValuesArray, 15)

        rowIndex = linkObj.Parent.Parent.Parent.Parent.Parent.RowIndex
  • gk1970's avatar
    gk1970
    Occasional Contributor
    Correct David.  My goal is to write a function which can be used across pages which render tabular data to find a status /perform an action based on the value passed.Hindrance in my method is that compare doesn't work and in your code , rowIndex =
    linkObj.Parent.Parent.Parent.Parent.Parent.RowIndex
    , doesn't that inject dependency where in one would need to know the hierarchy in advance ? Would I  be able to write a function to achieve that ?I guess that also depends on the framework used to render the objects ?



    Could you point me in the right direction ?

  • Hi Girish,





    I think that the approach you use is error-prone and more complex than the one I suggest. It is possible to improve my solution by looking for the needed parent object instead of getting a parent object on a hard-coded level of hierarchy. The needed parent object can be identified by one of its properties like 'id' or 'className'. Please post here or send me via the Contact Support form the HTML code of the entire table with all records and I will try to find such a property.