Previously I was using ShellWindows() API for IE to get the window Title and URL for my application Now with new development, Microsoft Edge is new and has many features under development.
I want to know how I can get the URL and Title of all the pages opened in MS-Edge. As none of the shell APIs are working with MS-Edge. I tried also with UI Automation but it does not return all the UI elements
I am using MS Visual Studio 2010 for development. Do I need new version of Visual Studio? Can anybody help me about how to access the Title and URL? Or Does MS-Edge not allow such an access due to security? thanks
I've just pointed the Inspect SDK tool to Edge, when Edge showed 3 tabs. (Inspect uses the UIA Client API to access all the UI shown in apps, and if you have the SDK installed, can be found in places like "C:\Program Files (x86)\Windows Kits\10\bin\x64".) The image below shows that the UIA element for the main Edge window has a child element which is a list. Inspect also shows me that the AutomationId of that child element is "TabsList", (but that's not shown in the image below). The set of list items that are direct children of the TabsList, have names which are the titles of the pages loaded in Edge. So it looks like it's relatively straightforward to access the titles of the pages loaded in Edge.
However, it looks like it's not so clean to access the URL associated with a page. When I looked through what Inspect was showing me, I only found the URL in the UIA tree for the page that's currently being shown. The URL can be found from the name of an element with a control type of Pane, which is beneath a chain of Pane elements. I don't know what the most robust way of reaching the element with the URL is. For example, if it's the only element with a UIA ClassName of "InternetExplorer_Server", or its parent is the only element with a ClassName of "TabWindowClass", then maybe a single call to FindFirstBuildCache() could get you close to the element you're interested in. (It looks like neither element has an AutomationId to search for.)
Thanks,
Guy
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With