I’m working on some scripted GUI test for a windows C# .net app. I’m using Ruby to drive the testing and my feet are officially wet in the realms of WIN32API – but I’m certainly not over-confident with it. As a mater of fact, I feel like I’m missing some fundamental understanding. At this point, the only way I know how to gain access to different controls is through the combination of control class and maybe some identifying text.
My problem is, the application I have to test has a series of several buttons – all of which contain an icon and no text.
Is there a method I could use to retrieve a specific button? I’ve played with the notion of doing this via relative positioning, but that kind of sucks, and I’m not super interested in it.
I have access to the source code; if there is some identifying attribute/property that I can set, I’m more than willing. I’m just ignorant at this point.
Unfortunately it’s probably not easy. You’d want to enumerate all the windows and their children and look for “clues” as to which one is the button you want somehow, all using the win32api.
An example of “enumerating all windows” can be found in win32screenshot (search for “window_titles”).
http://github.com/rdp/win32screenshot
-r