How to find user interface elements using locators and keyboard shortcuts in Windows applications
One way to automate Windows applications is to target UI components with their identifiers. Microsoft recommends Accessibility Insights for viewing the UI automation properties. Legacy tools such as Inspect.exe can also be used.
After installing and launching Accessibility Insights for Windows, inspecting Windows applications is straight-forward. Using the Windows Calculator as an example, hovering over the application displays the properties of the UI components.
By default, Accessibility Insights displays only a few properties, including the accessible
Name of the UI component in the
DETAILS pane. In this case, the name of the button is
Five. Using localized names for automation is not the most robust option since the labels change based on Windows language settings.
To see more properties, click on the settings icon and select
Include all properties that have values:
This will include the
AutomationId property. In this case, the value of that property is
If the application supports keyboard shortcuts (see Windows desktop application robot), it is recommended to use those whenever possible.
This is an example of a robot that controls a browser using only the
RPA.Windows library and available keyboard shortcuts.
See the robot in action:
Sometimes UI components in windows applications do not have an ID that could be used to target them, or they can not be accessed by keyboard shortcuts. In these cases it is still possible to locate them using image-based locators.
Windows desktop applications can be automated using UI component IDs, keyboard shortcuts, or image-based locators.