You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for creating such an amazing library! This is the first time I am actually commenting on anyone's work here on github but I saw lots of your videos and saw how helpful you were so I wanted to share something I discovered about UIA with you in case it will help you and other users.
This is not really an issue anymore as I already solved it but I wanted to share the solution with you in case you didn't know this and it might help you to further optimize your code or help other users with this knowledge.
So here was the issue. I was using firefox and on one website I found that I couldn't get the element that I wanted that was very deep in the tree to show up in UIA viewer (I knew it was in the group but I couldn't expand the group as the tree was already very deep) and as I result I could not select it even though I could see it on the screen. I tried using Accessibility Insights and it was the same issue.
For other elements when using walktree many times I could see exactly how to get to the element I wanted but I had to use the "p" several times because there were several group elements that weren't showing in the tree. I concluded that the UIA viewer and Accessibility Insights doesn't show all the elements but that wasn't a problem for me as I could use trial and error to figure out how to get to it. The first problem above was the main issue because I couldn't get to it even with walktree as it didn't show the element I wanted in the tree at all.
Here's how I fixed it.
I tried using UIA Viewer on a remote computer that I had and this time it showed all the elements in the tree including all the group elements as well. It was the same browser version and same UIA version so I was curious why it worked on one computer and not the other. I did a lot of experimenting and figured out that if I copy the UIAutomationCore.dll file from the computer that was showing all the elements and paste it into the computer that wasn't showing all the elements then I got all the elements in the tree to show up. That fixed all my problems.
Looking into it a little deeper it looks like the UIAutomationCore.dll that shows all the elements in the tree is an older version. If you use the latest version the tree will be shorter and doesn't show all the elements (especially the ones that are very deep in the group). I have only tested the version that I got from my remote computer and that is version 7.2.17763.1728. The one that used to be on my main computer is version 7.2.19... so it seems it is better to use the old version because the old version will show all the elements in the tree. I'm not sure if you knew this before but if not you might want to test it out. It is really amazing now that my tree shows everything. If it works well you might want to download the older version and link it to your code by default but you can check it out whenever you have time. I think it should help many people that have an issue with the tree not showing everything. It took me so long to figure this out :)
One last thing I wanted to ask that is unrelated to the issue. Is there a WaitElement function for the window element? Like If I want to wait for a new window to show up. I am using the GetElementFromHandle with try and catch in case the window hasn't appeared yet. Just wondering if you had a better way?
Thanks and keep up the good work! Your library is amazing.
The text was updated successfully, but these errors were encountered:
sukree3366
changed the title
I figured out how to get all the elements to show in UIA Treeviewer
I figured out how to get all the elements to show in UIA Viewer
Oct 31, 2024
Hello,
Thank you for your feedback and sorry for the late reply :)
I knew there are differences between UiAutomationCore.dll versions as I've encountered it before but haven't really found the time and interest to follow up on it. But it skipping elements sounds like it might actually be a bug, so if you're able to reproduce it for example with Inspect.exe or Accessibility Insights then consider filing a bug report with Microsoft. I've previously had some success with that...
Is there a WaitElement function for the window element?
Technically yes, you could use UIA.GetRootElement() and then wait for a window element. However, it's much faster to use AHKs built-in WinWait instead.
Hi Descolada
Thanks for creating such an amazing library! This is the first time I am actually commenting on anyone's work here on github but I saw lots of your videos and saw how helpful you were so I wanted to share something I discovered about UIA with you in case it will help you and other users.
This is not really an issue anymore as I already solved it but I wanted to share the solution with you in case you didn't know this and it might help you to further optimize your code or help other users with this knowledge.
So here was the issue. I was using firefox and on one website I found that I couldn't get the element that I wanted that was very deep in the tree to show up in UIA viewer (I knew it was in the group but I couldn't expand the group as the tree was already very deep) and as I result I could not select it even though I could see it on the screen. I tried using Accessibility Insights and it was the same issue.
For other elements when using walktree many times I could see exactly how to get to the element I wanted but I had to use the "p" several times because there were several group elements that weren't showing in the tree. I concluded that the UIA viewer and Accessibility Insights doesn't show all the elements but that wasn't a problem for me as I could use trial and error to figure out how to get to it. The first problem above was the main issue because I couldn't get to it even with walktree as it didn't show the element I wanted in the tree at all.
Here's how I fixed it.
I tried using UIA Viewer on a remote computer that I had and this time it showed all the elements in the tree including all the group elements as well. It was the same browser version and same UIA version so I was curious why it worked on one computer and not the other. I did a lot of experimenting and figured out that if I copy the UIAutomationCore.dll file from the computer that was showing all the elements and paste it into the computer that wasn't showing all the elements then I got all the elements in the tree to show up. That fixed all my problems.
Looking into it a little deeper it looks like the UIAutomationCore.dll that shows all the elements in the tree is an older version. If you use the latest version the tree will be shorter and doesn't show all the elements (especially the ones that are very deep in the group). I have only tested the version that I got from my remote computer and that is version 7.2.17763.1728. The one that used to be on my main computer is version 7.2.19... so it seems it is better to use the old version because the old version will show all the elements in the tree. I'm not sure if you knew this before but if not you might want to test it out. It is really amazing now that my tree shows everything. If it works well you might want to download the older version and link it to your code by default but you can check it out whenever you have time. I think it should help many people that have an issue with the tree not showing everything. It took me so long to figure this out :)
One last thing I wanted to ask that is unrelated to the issue. Is there a WaitElement function for the window element? Like If I want to wait for a new window to show up. I am using the GetElementFromHandle with try and catch in case the window hasn't appeared yet. Just wondering if you had a better way?
Thanks and keep up the good work! Your library is amazing.
The text was updated successfully, but these errors were encountered: