Quantcast
Channel: Windows Desktop Development for Accessibility and Automation forum
Viewing all articles
Browse latest Browse all 585

HOWTO Use UI-Automation with AutomationElement.FromPoint in C# like Inspect.exe in Windows SDK

$
0
0

Please help,

I'm trying to use UI-Automation's AutomationElement.FromPoint in C#, similar to the Inspect.exe tool from the Windows SDK.
The problem is that "AutomationElement.FromPoint" is evidently returning the wrong object.
At the minimum, it is not finding the correct object, with a bounding rect (AutomationElement.Current.BoundingRectangle).

But inspect.exe is.

As an example, run inspect.exe against IE11, when on the google.com website.
If you run AutomationElement.FromPoint from the screen position of the google.com's "search" prompt, the object returned will not have a bounding-rect (Rect.Empty). Also, the object returned from AutomationElement.FromPoint for the search prompt will not have a text value.

But in inspect.exe, which granted, uses the cursor, it will find the search prompt, and see its proper bounding-rect, and the text in the search prompt you type there.

Someone else has discovered this as well here:  http://stackoverflow.com/questions/34986741/automationelement-frompoint-gets-the-wrong-element
But, no solution has come forth.

How can I get past this issue with AutomationElement.FromPoint, and get the correct object, with its text and especially its AutomationElement.Current.BoundingRectangle, actually continaing the screen cooredinates passed to AutomationElement.FromPoint.


Viewing all articles
Browse latest Browse all 585

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>