Appendix 10: Windows Application GUI Tutorial
Process Studio Windows Spy is used for Windows Application GUI plugin, to extract Windows applications element attributes.
Windows Spy is a compact toolbar and occupies minimum screen area so that one can spy on a Windows application with ease. Upon spying it opens a Generate Step Window that has two sections – Attributes table and Step Generation.
Following are the shortcut keys available for Windows Application GUI plugin.
- Ctrl + Alt + X – To open Windows Spy. Windows Spy Interface opens as seen below. Notice that the background of lens is black color which signifies that the windows spy is not in active mode. Click on the lens icon.
- The background of the magnifying lens changes to white color which signifies that Spy is in active mode and you are ready to spy.
- A notification is shown when the spy goes in active mode. Hot keys are mentioned in notification text.
- ‘Shift’ or ’ ~ ’ will get information of that element on which mouse is present (Hovering) at that moment.
- Close any active Windows Spy by clicking ( )or ( with Ctrl+Q).
- All Windows elements can be detected using Windows Spy.
- Now hover over the element to Spy. Press keyboard key ‘Shift’ or ‘~ ’.
Windows Spy Best Practices
Following are the best practices while selecting criteria for element detection,
- It is recommended to detect elements with criteria having element index 0 (i.e. unique elements). Avoid using element index greater than 0 (e.g class name in snapshot below). Select the element having the element index as 0.
- If some criteria are dynamic then use criteria for which criteria value is constant (such as, If Absolute XPath or AutomationID are dynamic use criteria- Name if its value remains constant). Absolute XPath is best for constant application structure and dynamic element names.
- Use All criteria, every time if you have an application with no window name or if a spy doesn’t provide any absolute XPath or element index.
- While generating step or editing step, with critera All, replace any non-consistent criteria value with a blank value.
Windows Spy Workarounds
Following are Windows Spy workarounds,
- If element index below snapshot is null/not working then in criteria select All.
- If while trying to detect an element it gives a red border user can design step by copying windows path and criteria values from a different configuration of the same step or another step where the element is detected with a blue border.
- In mouse click suppose there are limited Action in the drop down, you may copy the windows path and criteria value and manually create the step on the element with desired Action.
- In Mouse action In case drag drop is not working you may use the Set Value step.
- We cannot use Windows Action, on pop-up windows, instead we can use Mouse Action- Click, or Surface plugin– surface Click or robot handing.
- In case Get Table Data is not working you may use Get Value step in a loop to fetch the table data row by row.
You may start Windows Spy from Process Studio toolbar or else using Shortcut/Hot keys as discussed in the section above. This opens Spy that can generate any Windows Application GUI step.
Following ate the steps to generate a step,
- Add a new folder to Spy project.
- Name the folder Windows Spy.
- Navigate to ToolsSpyWindows Spy to open Spy.
- If there is no active workflow respond to the warning message to create a new workflow.
- Select the project in which to create the workflow.
- We shall leave the default name for the workflow Workflow_1.
- Windows Spy toolbar opens as seen at the bottom right in the screenshot below.
- If the lens on the toolbar has a dark background then Spy is inactive mode, else with a white background it is in active mode.
- Click the lens in the Windows Spy toolbar. The background of the lens on the toolbar changes to white. You are now ready to start spying.
- Now hover over the element to Spy. Press keyboard key ‘Shift’ or ‘~ ’.
- Element is highlighted in blue color as seen that the notepad writing pane is highlighted in blue.
- You can also see that the Generate step window is opened with configurations as seen below.
- You may change the Step and Action from the drop down list. Provide a Step Name. Windows Path for the application is also populated.
- Pressing ‘Generate’ Button adds a new step to workflow with action and relevant data for the step as provided.
- The Step list in window “Generate Step” above changes as per the element detected.
It simply depends on type of action it supports. E.g. let say element detected is of type textbox. So it has step list – Element Action, Set Value, Get Value, Mouse Action. While for element of type checkbox step list is Element Action, Mouse Action.
- Also actions in Action list changes from type of element to other.
- We shall change configurations to Set Value. Click Generate.
- Step [Set Value] generated and added to workflow message appears as seen below.
- Set Value step is generated as seen below. Double click to open the configurations window.
- You may click Highlight to highlight the element. We can see that Notepad Writing pane is highlighted below.
Windows Spy from Step
Spy can be started from step dialog in most of the Windows App GUI plugin steps. In this section we will start Windows Spy from the plugin step.
Note: it is recommended to use windows Spy from Step to edit existing step rather than creating new similar step from other applications.
- Let us continue with the Set Value step we generated in the previous section. Double click the step to open the configuration window as seen below. Close any active Windows Spy by clicking ( )or ( with Ctrl+Q).
- Click on any of the configuration items to enable the Edit Element button. Click on Edit Element to start Spying.
- Opening spy with Edit Element button from a step is restricted to the step. Step is not editable as seen above and only relevant elements to the step are detected from active spy. We can call it as a ‘Step Restricted Spy’ for example,
- Suppose spy is started from ‘Set Value’ step. Now spy is restricted to elements that support Set Value in the same or other applications. However it is recommended to use Windows Spy from Step to edit the existing step configuration only. Supported elements will be highlighted with blue border and the rest with a red border.
- Suppose spy is started from ‘window action’ step. Now spy is restricted to elements of type ‘Window’ only. All element of type ‘window’ will be highlighted in blue color. If we try to detect element other than of type ‘Window’ it is highlighted in ‘Red’ color.
- You may use Hotkeys to detect elements. Pressing ‘Shift’ will help us know if element is supported for the step. Let us see the various scenarios in the following examples,
- Spy the writing pane of Notepad. You can see it is highlighted in blue as seen below.
- Hover over an icon of Microsoft Edge to Spy. Since no value can be set here, it is not compatible with Set value step. Hence it is higjhlighted in red as seen below.
- In the screenshot below a section of another application ManicTime is highlighted with a red box.
- The outer window of Notepad is also highlighted in red as it is not compatible with Set Value step.
- The name in the header of Notepad can be changed upon saving. It is compatible with Set value step and hence is spied and highlighted in blue.
- Certain title test in Manic Time application is compatible with Set Value step and hence highlighted in blue.
- This completes a high level tutorial of Windows Spy.
Refer Project 8: Spy and Folder Windows Spy in AutomationEdge_Process_Studio_Getting_Started_Guide_R6.0.0 for a sample workflow using Windows Spy.