This project is read-only.
More information about the module
Documentation in a file, blog posts, how to contact us, etc

Installation and valuable tools for UI automation

Installation for Metro UI testing
Installation for Java SWT applications testing TBD
Installation for remote execution TBD
How to find the proper commandlet
Valuable tools - free and complimentary tools that are helpful in UI automation
UIAutomationSpy TBD
UIARunner in progress
OnDemandRunner TBD
BGShell for Metro UI testing TBD

Getting started

Getting a window
Getting a control
Pipelining controls
Invoking actions on controls in progress
Invoking actions on controls via Object model
Checking the state of UI
Top-level objects
Context menus
Drag and drop

More on working with controls

Object model
Controls in progress
Clicks: the Control property, the Mouse property, Clicks
Keyboard emulation: the Keyboard property
Text: reading from and writing to in progress
Navigation among controls
3rd party controls

Event handling

Common rules for event handling
Invoked event
FocusChanged event TBD
WindowOpened and WindowClosed events TBD
MenuOpened and MenuClosed events
TooltipOpened and TooltipClosed
StructureChanged events
PropertyChanged event TBD
TextChanged and TextSelectionChanged events TBD
SelectionItemPattern events TBD
SelectionPattern events TBD

Additional capabilities

Screenshot hooks in progress
Custom hooks TBD
Error collection TBD
Delays TBD
Graphical trace TBD

Applications, frameworks, libraries that we support

Win32 sample TBD
Windows Forms sample TBD
WPF sample TBD
Metro UI (WinRT) app sample TBD
Java SWT sample TBD
Qt application samples TBD
PowerBuilder 12.5 samples TBD
Command tabs TBD

Sample scenarios

Standard Windows application TBD
WPF application TBD
Metro UI application TBD
Web page TBD

Specific use

The *Wizard* cmdlets
The legacy version of the Wizard cmdlets

Continous integration with UIAutomation tests

Common concerns
Jenkins sample TBD
TeamCity sample TBD
CruiseControl.NET sample TBD

Software testing extensions

Reporting about your tests (to be rewritten) - with or without TMX you are able to manipulate your test results
How to report every cmdlet TBD
How to interrupt test execution TBD
Speeding up test flow on a specific fail TBD

Module settings and data

Module settings (in progress) - the list of available settings
Module execution profiles (to be rewritten) - you can attach settings to a certain objects or code in your scripts
Collected data (to be rewritten) - some data are stored for immediate or future use

Troubleshooting guide

"Could not get a control" TBD
"Hot to get a control" TBD
"It does not click" TBD
"How to click ..." TBD
"How to do" TBD
"There's no such cmdlet as I need to"

Release history

Release history

Last edited Apr 8, 2014 at 6:24 PM by apetrovskiy, version 102


xinliu Mar 25, 2012 at 10:14 PM 
There are also several cmdlets that can help you investigate what's in the window you are dissecting. Currently, the provider is not writtern yet (dir (Get-UIAWindow -pn mmc) ) would be cool here, but it will be available only next month.

For example, the line of code Get-UIAWindow ... or Get-UIA[ControlType] | Get-UIAControlChildren display for you all the immediate children.
Another examples prints out all the control MS UI Automation can pull out from the window:
Start-Process services.msc -PassThru | Get-UIAWindow | Get-UIAcontrolDescendants | %{Write-Host $_.Current.Name $_.Current.AutomationId $_.Current.ControlType.ProgrammaticName;}

The cmdlet ConvertTo-UIAHashtable represents a control that was pipelined as an eye-friendly table:
Get-UIAWindow .... | Get-UIAButton -Name ... | ConvertTo-UIAHashtable

There is also the possibility to compare a bunch of control with a saved state.
The cmdlet ConvertTo-UIASearchCriteria saves a control as a textual hashtable, typical for cmdlets running jobs:
Get-UIAWindow ... | Get-UIAButton ... | ConvertTo-UIASearchCriteria

After that you can use Test-UIAControlState cmdlet to compare the current automation element's properties to saved from the previous run of a previous build.

Test-UIAControlState -SearchCriteria @{Name='OK';AutomaitonId='buttonOK'},@{AutomaitonId='335';IsEnabled=false}
Our testers really love these cmdlets to determine which control were changed, added or removed by the developers without a notification. :)

xinliu Mar 25, 2012 at 9:55 PM 
Alternatively, you can use the Start-UIARecorder cmdlet:
Start-UIARecorder -noc -nos -nou -wri -seconds XXX

it's a bit rusty and sometimes interrupts, but can generate pieces of code allowing the user to be less depending on experimentation.
This cmdlet generates two files: one short log and other is long, showing the full path to any control from its parent window. Sometimes it's a necessity (childwindows with the same name or similar problems).
There is also UIAutomationSpy.exe (that has the same bug, a sudden interruption under some circumstances) that shows the statement you need to use to achieve the control the mouse is over of for the moment.
The latter tool doesn't report UIAutomation patterns ,though. Whereas the cmdlet reports at least a part of patterns the control supports _at the moment of hovering the mouse_.

As you, ipan, noticed, pipelining is a great gift given as by the PowerShell team.
For example, you need click menu items to open the Options window in services.msc and click the OK button in it.

Virtually the whole code is one pipeline:
Start-Process services.msc -PassThru | Get-UIAWindow | Get-UIAMenuItem -Name File | Invoke-UIAMenuItemClick | Get-UIAMenuItem -Name Options... | Invoke-UIAMenuItemClick; # stop the pipeline as there is nothing to pipeline farther.
# Now, we need to get the child window.
# the main window is in the [UIAutomation.CurrentData];:CurrentWindow variable, so that we can try even such a piece of code:
# However, it might not work in several cases, then use a new pipeline:
Get-UIAWindow -ProcessName mmc | Get-UIAChildWindow -Name Options | Get-UIAButton -Name OK | Invoke-UIAButtonClick;

(Don't forget to be under administrator's credentials or UAC'ed - you are touching another process's innards).

xinliu Mar 25, 2012 at 9:32 PM 
yeah, documentation is a mythical beast I never could catch.
The last samples were published within the 0.6.5
and some information is put out here in the blog:

On tomorrow, I'll close the quarter (MBOs and similar stuff) and will try to write a small document the next week , I promise.

Publishing of the scripts used for our current projects doesn't make sense, because these products are completely new versions and nobody outside the company can download them to match the script code and the product. I'll use embedded applications like regedit, services.msc, compmgmt.msc, ADUC and so on to demonstrate how to use the module.

If you have a preference, please name the Windows application you'd like to be automated as an example, or a freely available one (if it supports MS Automaiton) - I can use as an example almost any available for all application that responds to MS UIAutomation (i.e., a Win32, .NET or Web app).

ipan Mar 24, 2012 at 1:19 AM 
I could not find proper documentation & example in this forum, in a step by step manner. It seems like a complex pipelining. Suppose if it is a step by step, we can understand better.