I am talking about the add-in – UI Automation, which has been introduced with UFT 12.52. I hope, many of you have already noticed this add-in, If you have not – check it out! In this post, we are going to discuss a bit about this. I really appreciate the effort by HPE to keep UFT with the pace of changes to support the new technologies and versions. UI Automation add-in enables support for the application that has UI Automation interfaces implemented with Microsoft UI Automation Framework.
With UI Automation, UFT now supports test automation for applications technologies which are not supported out-of-the box. Also it enables support for the application or application controls which are not working adequately with the standard existing add-ins. By saying that, I immediately rushed to check the most troublesome automation challenge from the beginning. I hope everyone will agree to this challenging step to have applications menu identified. And.. guess what, it does!! it does identify the menu object. Checkout below, I tried on Windows-Notepad Menu.
[fvplayer src=”http://automated-360.com/wp-content/uploads/2016/04/UI-Automation-NotepadSPy.mp4″ autoplay=”true” embed=”false” loop=”true”]
What is UI Automation Framework?
Microsoft .Net framework 3.0 and later includes this new accessibility framework called as Microsoft UI Automation Framework. It provides accessibility to most UI elements and it provides the information about UI element to the end user. You can interact with the UI by using automated test scripts. Read more about UI Automation framework here.
Did you notice the new add-in?
UI Automation Add-in can be used as any other add-ins available. Check the option on for UI Automation at UFT Add-in Manager window at startup.
Once you have the add-in enabled, the special options are enabled for object spy and recording modes and options.
At object spy window, you will notice a drop down option beside the spy button. Selecting UI Automation option, the spy button icon changes to object spy icon. It represents that UI Automation mode is enabled.
You can enable UI Automation mode while recording. Select UI automation from the recording mode drop down.
Rest is same as you do spy, add objects or record with other add-ins.
Here is the code snippets, that I tried on notepad menu.
SystemUtil.Run "C:\WINDOWS\system32\notepad.exe","","C:\Users\Saketk","" UIAWindow("Untitled - Notepad").UIAMenu("Application").UIAObject("File").Click UIAWindow("Untitled - Notepad").UIAMenu("Application").UIAObject("Open... Ctrl+O").Click Window("Notepad").Dialog("Open").WinEdit("File name:").Set "tracker.txt" Window("Notepad").Dialog("Open").WinObject("&Open").Click
Try it out and share your experience and tell us what you could figure out.