Unexpected results from GetMultiple

Oct 3, 2008 at 10:29 AM
Edited Oct 3, 2008 at 10:29 AM
When I run the following code on my AUT:


pane = (UIItem)functionalDialog.Get(SearchCriteria.ByControlType(ControlType.Pane));
IUIItem[] panes = functionalDialog.GetMultiple(SearchCriteria.ByControlType(ControlType.Pane));

The UIItem 'pane' is set with the first of the pane controls on the functionalDialog, but the 'panes' array is always empty.

Am I missing something about the way 'GetMultiple' works, should in not return (at least) the control thats returned in 'pane'?








Oct 4, 2008 at 7:23 PM
There is bug in GetMultiple which allows you find only items which are PrimaryUIItems. Pane is not a primary item hence it is not found. This would be fixed in next release.
Change needed for this is in UIItemCollection class contructor:

            foreach (AutomationElement automationElement in automationElements)
                  //REMOVE THE LINE BELOW
                 if (!ControlDictionary.Instance.IsPrimaryControl(automationElement.Current.ControlType, automationElement.Current.ClassName, null)) continue;
                    IUIItem uiItem = dictionaryMappedItemFactory.Create(automationElement, actionListener, customItemType);
                    if (uiItem != null) Add(uiItem);
                catch (ControlDictionaryException)
                    WhiteLogger.Instance.Warn("Couldn't create UIItem for AutomationElement, "+ UIItem.ToString(automationElement));

Oct 6, 2008 at 11:33 AM
Thanks for the speedy response; as I'm just evaluating White against a new AUT then I can wait for the fix in the next release.


Nov 9, 2008 at 1:21 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.