Windows Application Driver (WinAppDriver)

repository·master·Indexed 26 days ago

https://github.com/microsoft/winappdriver

A service that enables Selenium-like UI Test Automation for Windows applications, including UWP, WinForms, WPF, and Win32 apps on Windows 10. The project provides a UI Recorder tool and various C# sample projects—such as AlarmClockTest, CalculatorTest, and NotepadTest—to demonstrate automating modern and classic Windows applications using the W3C WebDriver Actions API.

Tokens
13.8K
Snippets
30
Records
92
Agent score
85%

What's inside WinAppDriver

  1. Explore WinAppDriver Samples and Tests

    master

    The repository provides resources to help you get started with automation:

    • Samples: Showcases common commands and operations like opening applications, finding elements, clicking, typing, and reading text. These can be run against built-in Windows 10 apps like Alarms & Clock, Calculator, and Notepad.
    • Tests: Used to verify WinAppDriver's own functionality. They cover API endpoints and complex UI elements such as DatePicker, SplitViewPane, and Slider. These tests demonstrate how to invoke commands in C#.
    • UI Recorder: A standalone tool that records UI events and generates XPath queries and C# code automatically.
  2. Identify sample applications for WinAppDriver testing

    master

    The following sample applications are provided to serve as targets for Windows Application Driver tests. Use these to practice or verify automation scripts against different UI frameworks and control types:

    • AppUIBasics: Contains all UI Universal Windows UI controls.
    • Input: Logs various input interactions.
    • Xaml Controls Gallery: Demonstrates controls available in the Fluent Design System and XAML.
  3. Check WinAppDriver system requirements and application support

    master

    WinAppDriver is compatible with the following environments and application types:

    System Requirements:

    • Windows 10 (Home and Pro)
    • Windows Server 2016

    Supported Application Types:

    • UWP
    • WPF
    • WinForms
    • Win32 (legacy)
  4. Capabilities demonstrated in Python CalculatorTest

    master

    The Python sample project demonstrates how to perform the following UI automation tasks using Windows Application Driver:

    • Creating a modern UWP (Universal Windows Platform) app session.
    • Finding elements using the name attribute.
    • Finding elements using the accessibility id attribute.
    • Sending click actions to elements.
    • Retrieving element values.
  5. Verify Windows Application Driver functionality

    master

    Windows Application Driver provides test suites to verify its functionality across three main areas:

    1. JSON Wire Protocol API: Verifies all supported API endpoints.
    2. Universal Windows Platform (UWP) Controls: Verifies various Universal Windows UI controls.
    3. Input Interactions: Verifies various input interactions (e.g., mouse, keyboard, touch).
  6. Getting started with WebDriverAPI in Visual Studio

    master

    Follow these steps to execute the test scenarios:

    1. Open WebDriverAPI.sln in Visual Studio.
    2. Navigate to Test > Windows > Test Explorer.
    3. Click Run All in the test pane, or use the menu Test > Run > All Tests.

    After a successful build, you can use the Test Explorer to select and run specific individual test scenarios.

    1. Open `WebDriverAPI.sln` in Visual Studio
    2. Select **Test** > **Windows** > **Test Explorer**
    3. Select **Run All** on the test pane or through menu **Test** > **Run** > **All Tests**
  7. Set up and execute CortanaTest in Visual Studio

    master

    Follow these steps to run the CortanaTest sample:

    1. Ensure WinAppDriver.exe is running on your test device.
    2. Open CortanaTest.sln in Visual Studio.
    3. Build the project: Select Build > Rebuild Solution.
    4. Open the test runner: Select Test > Windows > Test Explorer.
    5. Execute tests: Select Run All in the Test Explorer pane or use the menu Test > Run > All Tests.
  8. Use WebDriverIO with WinAppDriver

    master

    Because WinAppDriver does not implement the W3C WebDriver specification completely, you must use a specific webdriver dependency as a workaround. In your package.json, include the following configuration to ensure compatibility:

    "webdriverio": "^5.10.1",
    "webdriver": "git+https://github.com/react-native-windows/webdriver.git"
  9. Attach to an existing App Window using appTopLevelWindow

    master
    If an application is already running (e.g., Cortana) or has a long startup time, you can attach a new session to its existing top-level window. To do this, provide the window handle as a hex string to the appTopLevelWindow capability. You can retrieve this handle from a DesktopSession using the NativeWindowHandle attribute.
  10. Use WinAppDriver.Preview.Appium.WebDriver for Pen and Multi-touch support

    master

    To access pen and multi-touch input features via the W3C WebDriver Actions API, you must use the temporary WinAppDriver.Preview.Appium.WebDriver NuGet package instead of the official Appium.WebDriver package.

    When using this package, ensure you use OpenQA.Selenium.Appium.Interactions.PointerInputDevice instead of OpenQA.Selenium.Interactions.PointerInputDevice to access the full range of pen features.