Monthly Archives: October, 2012

Daily automation: dumping control’s genealogy

This is a new edition of the old post.

Note: this post is deprecated, please refer to my comment below.

One more way to find out where in the Automation tree a control resides is to use the Get-UIAControlAncestors cmdlet. We are told that TreeScope.Parent and TreeScope.Ancestors used as filter for search will call the functionality that is not yet implemented? However, the cmdlet does perform the search from the very bottom of the hierarchy to the topmost window. Let’s take Calculator and dump the control hierarchy:

Task: demonstrate using the search to the top cmdlet.

Requirements: perform search that consumes a part of control’s name and retrieve all the ancestors of the search result.

Solution: the following code prints out all the hierarchy in reverse order:

Set-StrictMode -Version Latest;

ipmo [path]\UIAutomation.dll;

# here we are searching for all the element whose names start with 'a'

Start-Process calc -PassThru | Get-UIAWindow | Search-UIAControl -Name A* | `

%{Write-Host "===========================================================";

Write-Host "@{Name='$($_.Current.Name)';
$_ | Get-UIAControlAncestors | `

%{Write-Host "@{Name='$($_.Current.Name)';

PowerShell 3.0 with excellent support of localized cmdlets

Thinking about keyword-driven testing… This was the second time I did something inside UIAutomationAliases.dll.

The last time, I added some aliases like Get-Button to simplify readability. Today, I went further and added more aliases, for example, in Russian.

It was the shock, powershell.exe works with these cmdlets even though they are seen as question mark sets on my English Windows 8 RP:

What’s more, ISE fully supports them:

Intellisense also works:

All tests were performed in PowerShell 3.0 (Widnows 8 RP).


Just for fun: after acquisition, our frameworks are used in a Fortune 50 company…

We’re here: , slightly above the fifty line…

%d bloggers like this: