I need to learn about how to set-up a winappdriver windows app test project in visual studio and inspecting the elements for a medium size windows application.
2 Answers
- Navigate to the WinAppDriver GitHub web page and download the latest version. I downloaded the 1.2 version
- After installation, you will find the diver at C:\Program Files (x86)\Windows Application Driver location.
- First, we need to enable Developer Mode on our Windows 10, Developer mode is not enabled. Enable it through Settings and restart Windows Application Driver
- If you have Microsoft Visual Studio installed, you will most likely have Element Inspector already installed on your machine
- In case you do not have it installed, navigate to the Windows 10 SDK site, download and install it.Run the inspect.exe and make sure it is working fine
**.
Create a new NUnit test project 2- download appium dependency from NuGet 3- Update an existing UnitTest1.cs class as follows:**
using NUnit.Framework; using OpenQA.Selenium.Appium; using OpenQA.Selenium.Appium.Windows; using System
[SetUp]
public void Setup()
{
AppiumOptions Options = new AppiumOptions();
Options.AddAdditionalCapability("app", "C:\\Windows\\System32\\notepad.exe");
Options.AddAdditionalCapability("deviceName", "WindowsPC");
DesktopSession = new WindowsDriver<WindowsElement>(new Uri(DriverUrl), Options);
Assert.IsNotNull(DesktopSession);
}
[TearDown]
public void Close()
{
DesktopSession.CloseApp();
}
}
4= Run the test Note: If some references or packages are missing, right-click on it and include it in the solution.
5- Create Windows Elements and perform actions Open up application under test (AUT), in our case it is Notepad.exe, and Inspect.exe tool to fetch locators.
Click on the Notepad text area and find the AutomationId attribute on the right-hand side of the Inspect.exe tool.
WindowsElement NotepadTextArea = DesktopSession.FindElementByAccessibilityId(“15”); NotepadTextArea.SendKeys(“Hello World”);
Try! try! ,Run the test! Run the test! Run the test!

- 181
- 1
- 7
@pawansinghncr's answer is correct, but I would also suggest trying out the UI Recorder (for the inspecting part), it's in the Releases page of the WinAppDriver's Github.

- 49
- 5