FAQ: Window Search and its implications
In this blog, Siddhartha has described Window search and Windowed properties. There a few implications of using Window Search.
- Window Search is applicable only if give Technology Name = MSAA
- If we specify multiple search properties (both windowed and non-windowed), all of them will be honored. i.e the control should match all specified search properties.
VisibleOnly (a Search Configuration) has a slightly different meaning in Window Search. During Window Search, only those windows which return true for IsWindowVisible API are treated as visible. What this means is that an Invisible Window element (in case of Windowed search) is one which has been hidden programmatically. (e.g:- this.textbox1.Visible = false)
In comparison, VisibleOnly for a regular search under MSAA technology will locate those controls with the following accessible states
a) Normal state
b) Invisible and Offscreen [i.e these controls are not visible to the user because they are scrolled out of viewing area.]
If you specify a windowed search property for a non-window control, it will return the containing Window control.
// WinEdit is not a window
WinEdit e = new WinEdit(container)
// ControlName is a windowed search property
// ControlId is a windowed search property
e .SearchProperties.Add(“ControlId”, “someid”);
For the code above, e will be bound to a WinWindow which is container for the WinEdit.
In the case above, If you specify other windowed properties (classname or accessiblename) it will fail to search the element.
Remember, Window Search is used whenever we specify any one of the Windowed properties as a Search Property.
Thanks to Siddhartha for clarifying my many questions in this area.