Please help,
I trying to get IHTMLElement objects from a C# client that uses the UIA api to a web page in IE11. To be specific, I am not the .NET wrapper class, as it is BUGGED, but rather, the COM based API. (Add reference to COM base UIAutomationClient, UIAutomationBlokcingCoreLig, UIA, and UIAutomationTypes).
With MSAA, this was possible by using MSAA's "AccessibleObjectFromPoint" for say a point on IE11 browsing google.com's serach prompt, and then use the IServiceProvide (COM base one Guid("6d5140c1-7436-11ce-8034-00aa006009fa")), and then call QueryService, to ultimately get the underlying IHTMLElement.
I do not know how to do this with UIA, if it is even possible. Some thoughts I have, is to maybe get the HTMLDocument of the page through UIA (somehow), and then use its getElementById, off the UIA's "AutomationId", which does match, as can be seen by using IE11's debugger (F12 and use the DOM-Point tool), and the Windows SDK's "Inspect.exe" tool, which will show that the UIA's "AutomationId" does match the HTML's id.
For reference, and clarifiction, here is the C# interface description for the IServicePRovider I was mentioning above:
[ComImport]
[Guid("6d5140c1-7436-11ce-8034-00aa006009fa")]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IServiceProvider
{
void QueryService(ref Guid guidService, ref Guid riid, [MarshalAs(UnmanagedType.Interface)] out object ppvObject);
}
Also for clarification, the IHTMLElement, comes from "MSHTML" (Add reference "Microsoft HTML Object Library" in the COM area, which once added appears as MSHTML in the references).