UiBot : Robots for Everyone!

Your Location: Training Center> Documents > 12.Info of Editing Target
12.Info of Editing Target

Any fully automated machine cannot avoid every mistake. When using the Target Selector, the common problem is:


• Moving the mouse does not allow the mask to cover the interface elements as the target (usually too large to cover the entire window)


The mask can only cover the interface elements, but when the generated data is used to find the target, this occurs: O. Incorrect selection: Interface elements can be found, but the interface elements found are not what we originally selected. O. Missed selection: The interface elements we selected at the beginning clearly exist, but cannot be found.


For the first case where the target cannot be concealed, we will describe it in more detail later. Here we mainly discuss the second case when the target can be clearly covered, but in operation, there is an incorrect selection or omission.


As we mentioned, in the previous section, when a target is selected, UiBot generates a series of data similar to that used to describe the target:


33 {"wnd": [{"app": "explorer", "cls": "Shell_TrayWnd"}, {"cls": "Start", "title": "start"}}}.


When UiBot runs the process, it is based on the description of the data to find the target. Therefore, when the wrong selection or omission occurs, there is a problem with this series of data which needs to be modified. How do we modify it? We must first find the "target" attribute in the "Properties" column, which is displayed in the following input box. Since it is an input box, theoretically you could edit its content directly, however, in reality, the input box is too small to edit. When you need to modify the target, it is recommended to press the button on the right of the input box. Modify the target. Then press this button which will allow a "target editor" window to pop up. The first half is a thumbnail, showing the general appearance of the interface element as the target. UiBot does not use this image when looking for the target; it is just for your reference. The second half is "Control Filter,” which re-displays the data describing the target in a tree structure.


Target Editor


In this tree structure, some features of the interface elements are preserved. These features are automatically selected by UiBot. Only when all these 34 features are satisfied will the interface elements be found. Moreover, because the interface elements are nested, UiBot not only records the features of the interface elements as targets, but also preserves the features of the interface elements at several levels above it. The characteristics of each level must be fully satisfied.


Line 0: Object and its Contents Below represent the features of the upper interface elements (the Windows taskbar) of the Start Menu Button, while Line 1: Object and its Contents Below represent the features of the Start Menu Button itself. When the process runs, UiBot searches step-bystep. First, it finds the first-level Windows taskbar, and then in the taskbar, it finds the Start Menu Button with all the features satisfied.


Such strict feature matching is obviously easy to result in "missed selection.” For example, we can see that Windows has set a "title" for the Start Menu Button, that is, the line titled "start" (the title is usually not visible to users, but it actually exists). UiBot takes this title as part of the feature, because in general, the title of the button does not change. However, if one day the title of this button does change, it will lead to an omission.


So, how do we modify it? We see that there is a checkbox in front of the title, which is checked by default. Simply click on the checkbox and set it 35 to an unchecked state. UiBot will not use this feature when looking for interface elements, even if the title changes. However, if too many features are removed, missed selection won’t occur but rather “wrong selection.” Take an extreme example: If you uncheck both lines:


cls:'Start'

title:'Start'


it's clear that any interface element under the Windows taskbar represented by 0: Object can satisfy the criteria, which results in incorrect selection. Therefore, if the interface elements are too complex or the features change often. Unfortunately, there are no specific rules in this case, so we can only experiment more and accumulate experience. Here are a few common lessons for readers to remember first:


• You may not understand some feature names right now such as cls, aaname, etc., but that is alright as we will go into more depth about these terms later on.

• Make good use of wildcards* which represent "matching arbitrary content.” For example, there is an interface element whose title feature value is "Name: Zhang San.” The latter "Zhang San" may change, but the former "Name:" does not change. Therefore, we can use title: "Name:*" as a feature.

• Be careful when removing features because removing features can reduce missed selection, but increase incorrect selection. When the 36 process is running, it is easy to find the missing selection, but the wrong selection may not be found immediately.


On the last point, it's worth mentioning in particular that when UiBot runs a process, most "targeted" commands throw an exception when they can't find a target (unless it's a command like "Judging whether the target exists"), and the process stops immediately and reports an error (unless you use try). Catch is used to catch exceptions to targets are easier to find. When an incorrect selection occurs, UiBot does not know that it will continue to run, and the error is not easy to detect.


Finally, it should be reminded that the same interface elements may change on different operating systems and browsers especially in IE and Chrome browsers. When displaying the same page, the same interface elements may have completely different characteristics, and in IE, version number will be regarded as a feature. As shown in the figure below, we also use IE and Chrome to open Baidu's home page, and select Baidu's search box as the target, but as you can notice, its characteristics are quite different.


With IE and Chrome, the characteristics of the same target are different. When makes processes with UiBot or uses it on other’s computers, please try to keep the development and production environment 37 the same to reduce unnecessary errors.


Are You Ready to Explore the RPA World?
GET STARTED