Not Getting All the rows

To locate table’
WebElement Table = driver.findElement(By.className(‘dx-datagrid’))

‘To locate rows of table it will Capture all the rows available in the table’
List rows_table = Table.findElements(By.tagName(‘tr’));

I am Using the above code to get the rows in the web table
it is not getting all the rows in it just 63 (we have more ) even though the rest of the Html code is the same just another tr with another row index nothing changed

Those <row>s are all visible when the page finishes loading, or you have to scroll down so they dynamically shown?

I just Notices that only 63 rows are visible at first then when i scroll down a bit some others appear and some disappear from the beginning
For examples
row 0-63 are shown before i scroll
then 21-80 are shown after i scroll more
then 41-100 …
im talking in the Html wise with the

I think this is the reason why you get only 63 rows of, I don’t know how many they are. It gets only what is loaded.

I had the same problem with a page which dynamically loading the next elements so I had first to make a script which scrolls down until finds the end of page. And then I look for the elements I wanted. Of course in your case is a bit different because as you said when you scroll down you are getting next elements but some of the already loaded ones disappearing.

Here is the code I use to scroll down to the end of page:

boolean isPageBottom = false
try {
	long lastHeight = ((WebUI.executeJavaScript('return document.body.scrollHeight', null)) as Number).longValue()
	while (true) {
		WebUI.executeJavaScript('window.scrollTo(0, document.body.scrollHeight);', null)
		long newHeight = ((WebUI.executeJavaScript('return document.body.scrollHeight', null)) as Number).longValue()
		if (newHeight == lastHeight) {
			isPageBottom = true
		isPageBottom = false
		lastHeight = newHeight
catch (InterruptedException e) {

You can give it a try if you like…

Thank you I will Give it a try and come back to you

1 Like

It Does not work unfortunately since as you said some are disappearing it is only getting the last couple of numbers visible

What if you try to repeat your initial script, the one which counts the elements, inside the scrolling one and every time which scroll to update a variable with <tr> counts until it finish? Just an idea… I am not any expert!!! :slightly_smiling_face:

I think it might work I was just thinking the same yet I need to:
know how much I need to scroll? then loop accordingly
when I reach the end? to stop the loop
and if I am adding the same element that I already existed i need to skip it if not add it (I’m getting elements from the table and adding them in a list)

1 Like

Can u help me and tell me how to check if you are at the bottom of the page ?
I think i got the rest just explain the code for me cause it might work
I need it :

while (not at the bottom){
do my function()
scroll down (x amount)

i think this is it i will try

1 Like