cancel
Showing results for 
Search instead for 
Did you mean: 

How to check for a row value for paginated records ?

Highlighted
Occasional Contributor

RE: How to check for a row value for paginated records ?

Good Morning David !

I had this already tried out.Please see the screenshot which shows that object doesn't exist,that's surprising.in help topics also,innerText is recommended.

That's easy to see because following code

Sys.Process("iexplore").Page("http:/XXXXX.com/OA_HTML/OA.jsp?page=/oracle/apps/po/document/order/webui/OrdersSummaryHeadersPG&OAHP=PO_BUYER_HOME_PAGE&OASF=PO_ORDERS_SUMMARY&language_code=US&OAFMID=83526&searchType=customize&fwkQBSearchTypeSource=/oracle/apps/po/document/order/webui/OrdersSummaryHeadersPG__HeaderQueryRN__201&_ti=888743756&retainAM=N&addBreadCrumb=N&OAPB=PO_BRAND&oapc=7&oas=gotAlpy2tTZu4kSu_ZWNuw..").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).Cell(7, 2).innerText

in object finder is shown in issue4.jpg and issue5.jpg reveals why it is ,I believe.

issue6.jpg clearly shows that within the cell ,it has other objects like table and not just the link object that's contained.

Important point i believe is that only for link I see this for some of the forms others its just that object in the cell,which makes it difficult to write a function for all forms to perform an operation like clicling a link/selection of radiobtn based on the number(typically invoice/PO) displayed in a row. So any alternative solution ?
Girish
Highlighted
Occasional Contributor

RE: How to check for a row value for paginated records ?

Is there anything I need to explain further ?



Girish
Girish
Highlighted

RE: How to check for a row value for paginated records ?


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

...
--
Dmitry Nikolaev

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

RE: How to check for a row value for paginated records ?

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
Girish
Highlighted
Occasional Contributor

RE: How to check for a row value for paginated records ?

Can this be done ?
Girish
Highlighted

RE: How to check for a row value for paginated records ?


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
--
Dmitry Nikolaev

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

RE: How to check for a row value for paginated records ?

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 ?
Girish
Highlighted

RE: How to check for a row value for paginated records ?


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.
--
Dmitry Nikolaev

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
New Here?
Join us and watch the welcome video:
Announcements
Script Wanted
Let's start July with new challenges!

Create a script to pass custom command-line arguments as a test parameter for the TechCorner tag!

Will you dare to take the challenge?


Top Kudoed Authors