New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FindAllDescendants does not return all descendants #614
Comments
So.. some further insights!
this leads me to believe this may have something to do with caching? |
Perhaps you could experiment by using using (var uia = new UIA3Automation())
{
var desktop = uia.GetDesktop();
var propertyLibrary = new UIA3PropertyLibrary();
var cf = new ConditionFactory(propertyLibrary);
var window = desktop.FindFirstChild(cf.ByName("<our application's window name>"));
var pane = window.FindByAutomationId("customContent");
var paneText = uia.TreeWalkerFactory.GetRawViewWalker().GetFirstChild(pane);
Assert.IsNotNull(paneText);
} |
@louislefevre thanks for your comment! and yup, that works, the following code works:
Still, FlaUI inspect tool does not see the children of window > Status_onUpdate > customContent and neither does window.FindAllDescendants(), while the normal inspect tool does. Since the 'customContent' is added at runtime by assigning a |
I am not entirely sure but I think inspect.exe does use the treewalker internally whereas FlaUInspect uses the FindChildren methods. If it works with the walker, use that. There are a ton of bugs in Microsofts framework itself so it is totally possible that your specific case only works with walking. |
@yaira2 has encountered a similar problem when using FlaUI with Files. The target element "CurrentPathGet" can be seen in Inspect: But |
I had a similar problem like this in a WPF application I worked on. In Inspect, I would see all the elements, but when I asked for children or descendants, I would get nothing. Finally, on the client side, I started printing information when elements were added to the GUI and when the After a couple weeks of debugging I finally put enough write lines in all the events on this very complex form to realize they were reloading all the elements of the GUI so many times the client was timing out on later OnCreateAutomationPeer events and just not handling them. The reason inspect.exe was working was because the mouse hovering over the controls triggered a gradient shift on some controls, which caused a redraw and the visual tree to be updated, which caused the automation element tree to be reevaluated, and since less was going on so it would not time out. I know there is not specific information here but I hope that the description of this class of issue might give you some ideas as to what to look for. |
Thanks everybody for your comments, in case this is helpful to anyone - we overcame the issue this way: |
We used a very similar work around before a set of changes which caused even more reloading of controls on the form. |
Describe the bug
Intermittently, calling FindAllDescendants() for our application's window returns a very partial list. For example, there is a text element, inside a Pane in the window which in not printed out with the rest of the elements.
When the bug reproduces, FlaUIInspect (using latest at this time, 1.3.0) shows the parent Pane element as not expandable.
Code snippets
Screenshots
And shows this for the parent pane element:
Additional context
Wow, I have been at it for DAYS. I tried everything I could think of including:
new UIA3Automation().GetDesktop().FindFirstChild()
, then callingFindAllDescendants()
orFindFirstDescendant()
with and without conditions in aRetry
loop...FindAllChildren
recursively...It just randomly reproduces.
The text was updated successfully, but these errors were encountered: