This module utilized the WinAppDriver service to run UI automation via Powershell.
Windows Application Driver (WinAppDriver) is a service to support Selenium-like UI Test Automation on Windows Applications. This service supports testing Universal Windows Platform (UWP), Windows Forms (WinForms), Windows Presentation Foundation (WPF), and Classic Windows (Win32) apps on Windows 10 PCs.
- Download Windows Application Driver installer from https://github.com/Microsoft/WinAppDriver/releases
- Run the installer on a Windows 10 machine where your application under test is installed and will be tested
- Enable Developer Mode in Windows settings
-
Clone the repo and import the module.
-
Start the WinAppDriver using:
Start-WinAppDriver
-
Start a new WinAppDriver session of Notepad using:
New-WinAppSession -App notepad
or
New-WinAppSession -App notepad.exe
or
New-WinAppSession -App 'c:\Windows\System32\notepad.exe'
-
To find an element in the application we can use the following
Get-WinAppElement -By Name -Value 'File'
Note: Elements are case sensitive!
-
Once you find element and you save it to a variable you can invoke a mouse click
$e = Get-WinAppElement -By Name -Value 'File' Invoke-WinAppClick -Element $e
-
We can also send keystrokes to a text element
$e = Get-WinAppElement -By Name -Value 'Text Editor' Invoke-WinAppKeys -Element $e -Keys @('Hello World!' ,'{ENTER}','This is Awesome!')