How to scroll a table inside a web page

Hi,

I am able to scroll the whole web page using JavaScript command: storeEval window.scroll(0, 100) but don’t know how can I use this command on a scrollable table inside the web page, or if there is some other command?

Do you have an example URL?

The actual URL is behind the login so can’t show that at the moment.

Example URL below is quite close. The difference is that the actual table loads only the visible row elements in the DOM. Example URL below loads the whole table data in the DOM. Not sure if all that makes any difference for the scrolling command?

https://datatables.net/examples/basic_init/scroll_y.html

In your example table I can scroll very easily by selecting an element in the lower part of the table (= same as I can scroll on websites).

An option that will also work (always) is to use xclick (click inside the table) and then xtype (KEY_DOWN).

The most important question is: What do you want to do with the table once it is scrolled?

{
  "Name": "5",
  "CreationDate": "2019-2-19",
  "Commands": [
    {
      "Command": "open",
      "Target": "https://datatables.net/examples/basic_init/scroll_y.html",
      "Value": ""
    },
    {
      "Command": "click",
      "Target": "//*[@id=\"example\"]/tbody/tr[53]/td[3]",
      "Value": ""
    }
  ]
}

Thank you for your help really appreciate that.

I see, the scrolling seems to work easily on the example as the table rows are loaded outside of the viewport but in my case can’t click the element in the lower part of the table.

I think the actual table uses lazy loading or other similar methods. For example, if the viewport is 7 rows, it only loads 7 rows, so I can’t click the element outside the viewport. Also, the table doesn’t allow to use the keyboard for scrolling. I can only scroll the table with the mouse scroll wheel or scroll bar on the side of the table. Couldn’t get the XClick work either, I would also like to avoid the XClick as it’s slow.

What I want to do is copy and insert a value from the column-2 into column-1 and loop through the whole table row by row. At the moment I am able to do everything else but not the scrolling as the script stops at the bottom of the viewport because it doesn’t scroll.

I couldn’t find a similar example URL so I made a test account for you if you would like to try it out?

https://aktiva.meritaktiva.fi/Authent/Login
demo.merit25@gmail.com
demo12345

Click form the top bar ”Purchases” -> ”Unapproved invoices” --> Test Company Invoice
Test invoice has 20 rows and depending from the browser (firefox/chrome) and screen size the viewport size is 7-13 rows.

I tried the test login. This is really tricky. Just as you said, the table only scrolls with the mouse wheel. No keystroke combination that I tried made the table scroll.

Yes, it’s really tricky, I think the only way is to use JavaScript. With the window.scroll(0, 100) I can move the main browser window but don’t know how to select the table element and use that command or if it’s even possible? And the XClick is the last solution I would like to use as it would be slow when looping row by row.