Forum Discussion

Adagio's avatar
Adagio
Frequent Contributor
7 years ago

How to scroll to the bottom of a custom table

Hi,

 while dealing with a custom table in Angular JS app, I'm trying to read the contents of the last row. In the beginning, I see only 20 rows. As I scroll down to the bottom, more rows get loaded and same things happen again and again. In the end, I see a total of 55 rows. HTML DOM also shows 55 rows, but in the beginning, it was showing just 20 rows. One this that's clear is that I can't rely on the DOM to get the row count. So I think scrolling down to the bottom of the table and then using 'EvaluateXpath'

method to calculate the number of rows would be the best idea.

 

At this point, I'm struggling to scroll the table to the bottom. Could anyone suggest any ideas on how to scroll to the bottom of a dynamically loading table?

 

 

Thank you

Abhi

4 Replies

  • AlexKaras's avatar
    AlexKaras
    Champion Level 3

    Hi Abhi,

     

    Assuming that you can scroll table down (via scrollbar, key presses, etc.), I would suggest to get initial rows count, scroll down, get current rows count and compare it with initial. If the number increased, repeat scroll down. Otherwise assume that you've reached end of the table.

    (Obviously, you will have to consider some additional logic to wait until new rows are downloaded and rendered, but the general idea remains the same.)

    • Adagio's avatar
      Adagio
      Frequent Contributor

      Thank Alex! Well scroll bar can't really be identified as an object. On the other hand, it's a custom table, I have to get the row count each time I scroll down and then wait. It's going to be a very strange/inefficient looking code. I would have to wait to find out a better approach. I'm sure there would be one, but I've been able to figure that out yet.  

       

      Thank you

      Abhi

      • AlexKaras's avatar
        AlexKaras
        Champion Level 3

        Hi Abhi,

         

        > I would have to wait to find out a better approach.

        Probably the best way would be to talk with developers and ask for their recommendations.

        However, if the table is dynamic and "more rows get loaded" when you reach the end of the table until all rows are loaded, I see only two possible solutions.

        First is to emulate the actions of the end-user. I.e. scroll down and wait until next portion of records is loaded.

        Second one is to call some function on the page that loads the next portion of records. This approach will load all records without the necessity to scroll down the table.

        But with any approach from above you will need to a) wait until records are loaded and b) have some indication that all records have been loaded and you may to go ahead in the test.

         

         

  • djadhav's avatar
    djadhav
    Regular Contributor

    I work with an application where I need to scroll down a listbox and the scroll bar is not something that can be mapped. I get the object dimensions, hover the mouse somewhere inside the box and I use the mouse scroll function to scroll down the items.

    object.MouseWheel count