cmpenn
8 years agoContributor
Find and FindChild methods returning functions instead of objects
Working with a dev and unable to see why this keeps happening. We narrowed it down to the find method using the following:
this.GetComboBoxItemByText = function (text) { var thing = this.Popups.GetPopupByIndex(1) .WPFObject("PopupRoot", "", 1) .WPFObject("Decorator", "", 1) .WPFObject("NonLogicalAdornerDecorator", "*", 1); var thing2 = thing.FindChild("TextBlock", text, 2, true); return thing2; }
When looking at the local variables,
thing is an object
thing2 is a function
thing2 should be an object, and is failing when trying to click on it after this call.
My guess is that it's because
this.GetComboBoxItemByText
is assigned to what is returning as the function... but if the function failed, like due to improper parameters, it might just return as the function and not as the result of the function... just my best guess.