In GoTest, the capability to perform tests on desktop applications using Remote Libraries exists; however, this approach proves complex and requires substantial configuration. Nonetheless, with the integration of the ApplicationLibrary.DesktopLibrary, this process is significantly simplified. This library extends the functionality of AppiumLibrary for mobile application testing and adds support for automating Windows applications in a desktop environment. Through this integration, putting your windows applications to the test within a desktop context becomes straightforward and efficient. It provides you with carefully crafted keywords to be intuitive, thereby easing the creation of test scripts without the need for advanced expertise.
Please ensure to activate Developer Mode by accessing Settings → Update & Security → For Developers.
Installation of WinAppDriver
- Downloading WinAppDriver
- Installing WinAppDriver
- Configuring the machine to receive incoming requests.
Before initiating your tests, make sure to start WinAppDriver properly by running the script below as an administrator: LaunchWAD.bat. This action initiates the launch of the WinAppDriver server in listening mode, thereby facilitating the necessary interactions with the user interface.
Disconnecting from remote session without closing
To disconnect from the remote session without closing it, run the script below as an administrator: LogoutRDP.bat. This procedure ensures the session remains active when you want to disconnect from the remote session.
Creating Desktop Tests
Use the keywords provided by ApplicationLibrary.DesktopLibrary to establish targeted interactions with elements of the user interface. Create your test scenarios by clearly stating the required actions and expected outcomes, while cleverly incorporating the concepts of ID and Xpath to precisely identify the intended elements.
To find the IDs and Xpaths of elements, two main approaches are available to you:
Accessibility Insights for Windows
This tool is designed to assist developers in identifying and debugging accessibility issues in Windows desktop applications. Its use is also beneficial for discovering relevant IDs and Xpaths. Through the Accessibility Insights tool, you can pinpoint distinctive attributes of elements you want to target in your test scenarios. It supports three main workflows:
- Live Inspection: Verify that elements have appropriate properties by simply hovering over them.
- FastPass: Helps identify high-impact accessibility issues.
- Troubleshooting: Enables you to diagnose and resolve specific accessibility problems.
Steps to download Accessibility Insights for Windows:
- Download Accessibility Insights from here.
- Launch the Accessibility Insights application.
- Here is an example demonstrating how to inspect elements of the user interface using the "Live Inspect" feature.
WinAppDriver UI Recorder Tool
A convenient alternative for identifying IDs and Xpaths is this user interface recording tool designed for WinAppDriver. It allows you to interact seamlessly with the desktop application while automatically creating scripts that incorporate the chosen elements' IDs and Xpaths.
This tool facilitates the inspection of user interface elements and generates an Xpath query for each element.
- Download the recorder from this link.
- Extract the zip file.
- Double-click on WinAppDriverUiRecorder.exe to launch the recorder.
Here is an example of how to obtain an XPATH in the Calculator application:
GoTest Script Example
This script example can be used to test the connection of ApplicationLibrary.DesktopLibrary between GoTest and your Windows machine.
Set up a scheduled task on the target machine to start WinAppDriver using the previous script as the target program. Access Task Scheduler → Task Scheduler Library → Create Task
General: Enter the task name and check the Run with highest privileges box.
Triggers: Select Begin the task on connection to user session.
Settings: Choose Run a new instance in parallel if the task is already running.
For instance, to disconnect from the remote session without closing it, you can create a batch file shortcut that you run from the Desktop by performing a single double-click.
Start by navigating to the folder containing your batch file → Right-click on the file → Send to → Desktop (create shortcut).
Next, go to the Desktop → Right-click on the file shortcut → Click on Properties → Click on Advanced → Check the Run as administrator box.