Initialize UIautomation tree from an element whose ClassName is Chrome_RenderWidgetHostHWND. Accessability Insights - accessibility-insights

I need for get UIelements using "UIautomation" technology from another programms in windows OS.
Some programms has "chrome-like" browsers for content rendering.
The methods are get element (like c# AutomationElement.FromPoint / FindAll) return browser element with ClassName "Chrome_RenderWidgetHostHWND" and Name like a "Chrome Legacy Window". But i need the content elements in that browser.
I found out that, programm "Accessibility Insights" can do it!
Run application, "Microsoft Teams", for example
Run "Accessibility Insights"
Move mouse on "Microsoft Teams", we get "Chrome Legacy Window"
After any mouse click (left/right) on target programm ("Microsoft Teams") provoke rebuild UI tree
Then UIautomation technology can get all inner UI elements in browser.
"Accessibility Insights" source code is https://github.com/microsoft/accessibility-insights-windows
I studied it very carefully, but not found code, that provide rebuilding (or, initializing?) inner UI elements.
Any one can help me?
What i should to do for win my task - get inner UI elements in chrome-like browsers at another programm on windows OS?
If you've read to the end, thank you

Accessibility Insights for Windows doesn't interact directly with the UI Automation system. It builds on Axe.Windows (Source code), which queries and exposes the UI Automation properties. In the case you're describing, Axe.Windows is walking the UI Automation tree in response to a UIA_AutomationFocusChangedEventId message from the UI Automation framework. That notification gets handled by the onFocusChangedEventForSelectingElement method of FocusTracker.cs. Hopefully that will be enough to get you started.
--Dave Tryon (Accessibility Insights team)

Related

Microsoft Teams Desktop application Automation with Selenium

Was following the Article https://applitools.com/blog/automating-electron-applications-using-selenium/ to automate MS Teams Desktop application. Able to start, perform actions on elements, but got to the point when new popup appears and it is a "webview". Would appreciate any advice to find a way to locate elements in the webview, is Selenium able to switch to it? Or some other tool to use for automation this type of applications?

Can you make a keyboard shortcut to select a button on a website?

This question is mostly just out of curiosity at what's possible. I'm interested to know any ideas at all.
If I'm on a website, is it possible to make a keyboard shortcut for clicking a button on that site? For example, if I'm on google.com, is it possible to write a script somewhere on my own system that will detect that I'm on google.com and make it so that if I press ctrl-g while that site is in focus, it will click Google Search?
If you know for sure that this isn't possible and have an explanation for why, I'd be interested to know that too.
Yes, it's possible.
I'll briefly describe how to do it in C# and Chrome, but it's not language-dependent and could be used in Edge or IE either.
Get the currently focused window by calling GetForegroundWindow API.
Get the process id by calling the GetWindowThreadProcessId API.
Get the process name by process id.
Proceed if it's Chrome.
Get access to UI Automation COM interface.
You will need to consume the COM interface in your language, but in C# it's quite easy: you'll need to add a reference to COM -> UIAutomationClient to your project. This will generate a wrapper for you, so the COM interface will be accessible in the code in a usual OO-style.
In Chrome, the Accessibility options must be enabled first to get access to UIA.
It could be done manually by navigating to chrome://accessibility/, but it's possible to do it programmatically as well.
Use UI Automation to detect the active URL.
You will need to find the Address bar in the UI tree using UIA by its Name or ClassName or another unique identifier.
You could first retrieve the UI Automation element for the Chrome window and then use the FindAll method to find the Address bar in the subtree to get its Value property which should contain the current URL.
Inspect tool will help you to investigate the Chrome UIA element tree and element properties (like Name or ClassName).
Do the same steps to find the Google Search button in the UI tree using UIA.
Call GetClickablePoint method to get its clickable point.
Click on the button programmatically using Win API.
To do this on a global shortcut, you could place a keyboard hook by calling SetWindowsHookEx API. Or use a library.
Here is another way.
That's it, easier than it looks.

Functional tests for office-js Excel addin (Selenium?)

We develop office-js based addin for Excel and we've come to a place where we want to write automated functional tests (preferably with Selenium) for desktop version of Excel on Windows.
First issue we've encountered was that different combinations of Excel/Windows use either IE/Edge's webview underneath. Let's let IE die and assume we just need to test with Edge webview (EdgeHTML, as Edge-chromium webview is not yet released).
So the main issue is: we cannot (or don't know how to) connect addin's webview with Selenium, because we're not responsible for launching webview's process - it's launched by Excel itself. Is there any recommended way to run functional tests for desktop version of Excel with addin inside? We can control Excel itself through COM, so that's not an issue. But how to control the webview underneath addin?
We've tried WinAppDriver, but it gives windows-specific XML of generated window, not addin's HTML we'd like to see, making navigation and assertions fragile and complicated.
I think we searched just everywhere and couldn't find any pretty solution, so dirty hacks are also allowed, as long as they will work reliably and not too slow.

Simple Chrome extension w/ Context Menu cmds that call VB .net procedures

I'm looking for some input on how feasible it would be to create a Chrome extension that, when activated via toolbar button, adds context menu commands that call procedures (or methods of a class) written in VB.net.
That's pretty much it. At this point, i'd be thrilled to see context menu items that simply display message boxes built in VB.net.
I'm starting with Chrome, but would anticipate replicating similar functionality in other browsers, starting with Edge or IE, then Firefox and possibly Safari. If it's easier to start with another widely used browser besides Chrome, i'd be fine with that.
I've done the obvious google searches, and I can't seem to find an easy-ish place to start. Any ideas?
--edit, just an additional note, the VB.net procedures would be contained in a dll, exe, or other container installed on the client side machine. I'm not trying to execute server side code

Unable recognize an object on a Silverlight app using Ranorex automation

I am not able to recognize an object on a Silverlight app using Ranorex automation. Whole app is identified as a single window. Objects like dropdown, buttons etc inside an silverlight app is not recognized with ranorex tool. With this I am not able to continue my automation. Please provide the solution for the same.
A similar question was already answered in the following thread in the Ranorex Forum.http://www.ranorex.com/forum/not-able-to-detect-ui-objects-inside-a-silverlight-applicatn-t4335.html