Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Looking for a GUI automation framework that works with .NET (WinForms)

Currently we're using AutoIT for automating a few internal tools built with WinForms.

This is not a smooth process since AutoIT does not handle .NET windows very well as far as I could see.

I'm looking for a framework that is:

  1. Free (or very cheap).
  2. Works with WinForms/WPF and any other .NET technology. By this I mean robust control identification that will redue overhead of maintaining the
    project with every small UI change of the application.
  3. No scripting/minimal scripting involved (if possible - in a popular language).
  4. Record mode to record runs.
like image 606
lysergic-acid Avatar asked Apr 06 '11 07:04

lysergic-acid


People also ask

What is GUI automation?

GUI automation is the process of simulating mouse and keyboard actions on windows and controls. Most automation tools are based either on the coordinates of the controls or the text they contain, but this is not always reliable.

What is UIAutomationProvider?

Description. Provider API (UIAutomationProvider.dll and UIAutomationTypes.dll) A set of interface definitions that are implemented by UI Automation providers, objects that provide information about UI elements and respond to programmatic input.


2 Answers

You could use White. From the site:

White is a framework for automating rich client applications based on Win32, WinForms, WPF, Silverlight and SWT (Java) platforms. It is .NET based and does not require the use of any proprietary scripting languages. Tests/automation programs using White can be written with whatever .NET language, IDE and tools you are already using. White provides a consistent object-oriented API, hiding the complexity of Microsoft's UIAutomation library (on which White is based) and windows messages. Only stable versions of White are released, so all releases are production-ready.

like image 61
SuperOli Avatar answered Nov 02 '22 23:11

SuperOli


Posting explicit AutoIt code from the comments...

#include <DotNetIdentification.au3>

; "Test App" is a fake application with a control named "txtShowMe". 
$WindowName = "Test App"
$WindowText = ""

$control = NET_ControlGetHandleByName( $WindowName, $WindowText, "txtShowMe" )
if @error = 0 then 
    WinActivate( $WindowName, $WindowText )
    ControlFocus( $WindowName, $WindowText, $control )
endif
like image 35
Mike Pennington Avatar answered Nov 02 '22 23:11

Mike Pennington