Is there an equivalent of scrollToElement for Windows?

I posted previously that I’m trying to navigate a tree structure in an older Windows app:

I’ve found that I can “navigate” to tree elements, and “double-click” to open them, but double-click doesn’t scroll to the target item.

And it appears that double-clicking on an offscreen item doesn’t trigger it to reveal the child tree beneath it, so I don’t get anything from it.

A single click seems to perform a scroll operation, so I’m trying to figure out a sequence uaing, click, double-click and sendKeys (Escape) that will get the tree item onto the screen so I can open it.

However I came across scrollToElement for WebUI which sounds like its tailor-made for what I want it to do, but I can’t locate the equivalent for Windows.

If there is a scrollToElement for Windows apps, would someone kindly point me to it?



Previous post:

I’m not an expert with WinAppDriver - but I found these…

There could be more out there but your free help with web searching is terminated :upside_down_face:

Thank you VERY much!

I have fruitlessly been including “Katalon” in all my searches, and come up with very little. The WinAppDrv driver and concepts are new to me, and it never occurred to me that might be part of the issue instead of just Katalon. Hindsight is 20/20 but one thing I’ve found that would be helpful in the online documentation is a mention of what package to use for a given method or class.

In the code samples I found the import for scrollToElement was in “WebUI”:

import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI

So I assumed that katalon.core.something… would be where to find a Windows version, but I hadn’t found an incantation that would work. But much of the documentation, notably for Windows, doesn’t show the import statements, just the code using them.

I’ll use LMGTFY in the future! :slight_smile:


You know, that’s so funny. The thought to “do that” to you did cross my mind. But, alas, we don’t (or try not to) behave like that round here :nerd_face:

p.s. I don’t use google (nor should you)


Use Robot actions to hit the app with page-down etc.

Might be a little flaky though to target the right spot.

So I still think there has to be a better way, but I got it working.

The problem is that XPath in this app is meaningless, and as far as I can tell, I don’t think I can search with two locators at the same time (e.g., control type = Control.TreeItem and name = “xyz”. Instead, I pull back the list of children which includes bitmaps, buttons etc., and find the text in the list that I’m looking for.

There are a dozen ways to proceed from there, but I didn’t want to code an infrastructure based on this particular apps design (which other than as a user, I have no access to) so I just wanted to double click on an item to open it, then process the list it contains

But as I said above, double-click won’t scroll the item into view. Several of the resources you indicated imply that the object in the app may not have “scrollable” enabled for that action type. Whatever. I needed to get it on screen.

“Click” as it turns out DOES scroll. But findElement returns the text, not the control. So “clicking” goes into text edit mode. Argh!

So the incantation is 1. click the item to scroll it into view, 2. find some other thing to click on that isn’t text but is visible, 3. double click on the thing I clicked on before.

Unfortunately, there is something wonky about retrieving the “last” thing I clicked on, possibly because the search space changes each time I click and do findElement.

But it was close enough. I tell it to click on the WindowsTestObject that I supposedly just clicked on, and though it doesn’t find it, it DOES jump back a seemingly number of random “rows” which has the desired affect (hmmmm, wonder if its a “focus” thing?).

Then double-click works. Its slow as molasses but I managed to navigate an entire tree structure.

Not sure if this is WinAppDrv, Katalon, my wierd app, or a delightful combination of all three.

But I did it. It works. I’m on a deadline but when I get a chance I’ll try posting some code and maybe someonoe might be so kind as to take a gander and tell me what I’m doing not quite as right as I could.

Thanks again! The pointers were invaluable!


You’re welcome. Glad you got something to work.