Advanced Use Cases
Declaration of a Multilingual Application
If the AutomationId property can't be used, you can set a criterion on the Name property. For multilingual applications, you can set different values for this criterion, combined with the OR operator (see Criteria Management).
Page is dynamically created and some MustExist Items are not present at load time
When you declare a page that has a RefreshMode parameter equal to 'Window' and a MustExist item, that item must be recognized when the page opens.
COMMAND event is tracked but doesn't fire
In some cases, a COMMAND event tracked on a button doesn't fire when the user clicks it. This is a known problem due to a default in the implementation of the UI Automation protocol by the controlled application. To get around this problem, you can tell to the connector to listen to another type of event termed WinEvents. You must do this explicitly in a script using the listenWinEvents method:
This method must be executed at least once to activate the workaround.
Declare Pages That Have Multiple Instances
Most pages target only one screen. To optimize page recognition performance, the UI Automation connector only searches for the first target of a page. If you need to manage a page that has multiple targets, check its Multi-instance parameter. For details of page parameters, see Page Parameters.
Collect Item Values When the Screen Closes
Some use cases implies collecting Items value once the Screen closes.
This collection must be executed when receiving the UNLOAD event notification. At this time, targeted components will have been destroyed, so you can't use controlling to read item values.
The only way to collect this data is to set the Capture Auto parameter on the associated items. This parameter tells the connector to:
-
Collect the value of the component associated with the item every time a technical event is notified (not only UNLOAD).
-
Store this value in the event data.
If there is no technical event to collect an item's value, you can tell the connector to collect data each time a polling occurs, by setting the page parameter Auto Capture on polling. Please note, however, that this option is time-consuming, because item recognition is performed on each polling.
Right-Click an Item
Using this connector, you can right-click an item using the actionApp method as follows:
The right-click is performed in the center of the item. You can force a right-click at another position relative to the top-left corner of the item by setting offsetX and offsetY values:
If you need to right-click an indexed item, you can set the desired index as follows:
Example:
Script Recognition with the Occurs method
It is sometimes impossible to target a component simply by using item declaration. In these cases, you can use the Occurs method.
For indexed items, the Desktop Agent connector targets all the occurrences of the recognized components. You can then use the appropriate index value in a script to target the desired occurrence.
Consider the following use case:
Capture Pages With Huge Trees
Sometimes, capturing pages with UI Automation can take a long time, depending on the application. There are two ways to reduce this delay:
-
If it takes a long time before the page you wish to capture is given the focus, uncheck the ShowAll button to avoid exploring the whole tree
-
If the capture itself takes a long time, click the Int button to stop counting and start capturing. You will then have a partial capture, which may be big enough for the purpose of declaring items
Control Qt Applications
Controlling Qt applications requires:
-
A Qt accessibility plugin to drive complex controls (such as trees)
-
Version 7 of Microsoft Active Accessibility (MSAA) to enable this plugin (automatically installed by security update http:/support.microsoft.com/kb/2564958)
Click a Button that Opens a Modal Popup
If you have to click a button that opens a modal popup, the MyAppli.MyPage.MyButton.click() method can:
-
Block the execution of subsequent actions
-
Block the receipt of technical events.
To avoid this, you can perform a mouse-click instead, using the MyAppli.MyPage.MyButton.click(true) method.
From version 3.3 of the SAP GUI connector, this problem is solved by performing asynchronous clicks that do not lock the connector.
You can disable this mechanism by setting the AsyncElementInvoke setting to false in the CxUIAProvider.xml file in theconfig subdirectory of Interactive.