Select an item from scroll able web table

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
Posts: 8
Joined: Tue Jun 21, 2016 1:53 pm
Location: Germany

Select an item from scroll able web table

Post by Langrisser » Mon May 13, 2019 3:51 pm

Hello there,

I am currently writing a web test [Ranorex 9] under chrome to remove a user from a table:

I want to remove a User called 'Dummy User'. To remove the user I need to select him at first step. And here is my little problem:
My repo item for the table only has visible entries in it(like for 1 til Alison). See the attached rxsnp file.
table.png (10.74 KiB) Viewed 826 times
Can you tell how I can reach the entry for 'Dummy user' to select this specific user?
Thanks in advance!
(80.77 KiB) Downloaded 39 times

User avatar
Certified Professional
Certified Professional
Posts: 222
Joined: Mon Jul 11, 2016 2:15 pm

Re: Select an item from scroll able web table

Post by Vega » Mon May 13, 2019 7:43 pm

Well there are a few ways to go about this depending on your AUT. If you have coders available on your team, you can loop trying to find the name you are looking for and if it is not found, scroll and search the new names that are now visible. Rinse and repeat until your specified name is found.

If the list is in a fixed order, you could utilize recording modules and IF conditions to test your scenario. So for example if the list is always in the same order and we know it takes 10 scroll actions to reach the name you are looking for, then you can have a specific module which scrolls the correct number of times to the specified name.

So let's say you are looking for the name David and it takes 5 scrolls from the top of the list to make the name David visible. Here is how it would go:
  • Data source has the value 'David' which is the name you are looking for
  • You have a recording module which scrolls exactly 5 times to find the name David, performs the needed actions and then scrolls back to the top of the list. (optional) We want to scroll back to the top so you always start in the same spot if you are doing more searches afterwards
  • Then you would place this recording module in a test container (testcase or smart folder) and set an IF condition to only execute the container if the data source value is equal to 'David'
form1.png (33.98 KiB) Viewed 812 times
It does not have to be structured exactly like the example above, but this should point you in the right direction. So as you can see, each name would have its own recording to both scroll to the specified name and act on it.

Hope this helps

User avatar
Ranorex Guru
Ranorex Guru
Posts: 6797
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Select an item from scroll able web table

Post by odklizec » Tue May 14, 2019 2:39 pm


I'm dealing with similar lazy-loaded lists/tables, by using 'while' loop and Down or PageDown shortcuts. If Down/PageDown does not work with your table, you will probably have to mouse click the scrollbar? Here is an example of code I'm using in my projects:

Code: Select all

public void ScrollToElement(RepoItemInfo repoItemToFind, Adapter listBox)
		SpanTag foundElement=null;
		Keyboard.Press(System.Windows.Forms.Keys.Home, Keyboard.DefaultScanCode, Keyboard.DefaultKeyPressTime, 1, true);
		while (!repoItemToFind.Exists(5000, out foundElement))
			Keyboard.Press(System.Windows.Forms.Keys.Down, Keyboard.DefaultScanCode, Keyboard.DefaultKeyPressTime, 1, true);
//		foundElement.EnsureVisible();
//		foundElement.Click();
		Keyboard.Press(System.Windows.Forms.Keys.Enter, Keyboard.DefaultScanCode, Keyboard.DefaultKeyPressTime, 1, true);
That is the 'easy' part ;) Now the real problem is, that the very last item is always outside the visible area of table, yet, the item is marked as visible=true! So in case the dummy item, you are looking for, is at the very last table position, the mouse click may fail to click it. And sadly, EnsureVisible is useless here. So you will most probably have to use Enter shortcut, as I'm using it in my sample. Of course, the pre-requisity is, that the item you want to 'enter' is already selected. Otherwise, Enter shortcut may eventually confirm wrong item.
LastItemInvisible.png (99.71 KiB) Viewed 797 times
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration