How to get ScreenAttributes for UIItem at runtime?

Jul 14, 2009 at 2:29 PM

I'm writing Snoop-like application which prints White-specific information when mouse pointer goes over UI control. It works more or less now, but I still don't understand how to get ScreenAttributes for UIItem at runtime. I.e. it would be really useful to get ScreenAttributes.IndexedAttribute value to access UIItem later. Any ideas?

Jul 15, 2009 at 4:30 AM

ScreenRepository is bit on the back burner and am focusing whatever time I get on the Core. At the same time would be glad to take patches.

Jul 15, 2009 at 6:33 AM

Yeah, I'll contribute my piece of code as soon as it gets to be stable and useful.

Anyway, it looks like problem needs to be clarified - I have rather complex GUI application, that uses GUI framework build on top of WPF. There are almost no automationId properties filled, so, when I'm using White.Recorder, it prints me a class with huge list of controls identified by indices and named as button0, button1 etc. Some of controls are identified by automationId, but this amount is rather small. So, tracing each button0 etc to real GUI element is a real pain.

What I'm trying to do here is to supplement Recorder work with another app, which prints me the same identification information that Recorder does, but when I'm pointing over the control. So, the question is how to get all these Repository.ScreenAttributes.AutomationIdAttribute and Repository.ScreenAttributes.IndexAttribute at runtime, like Recorder does? Investigating its source code didn't gave me too much (too complicated and almost no comments), but it looks like at least index values are enumerated on UI class generation - maybe I'm wrong.


Jul 15, 2009 at 10:30 AM

At runtime the framework created the dynamic proxy objects for each of the UIItems. This is to do lazy loading. When these objects are accessed they are instantiated. You need to to look into the interceptors (in the Repository project) to figure more about it.