Target Element Definition
Editing the Target Defintion
Almost all actions must refer to one specific element on the page. One basic problem is to find a proper description of that element so CYW can unambiguously find the target element after each page load.
In every edit dialog of a targeted action you will find a group of input controls called "Target Definition". Let's first shortly explain every parameter:
- Definition Style
- In this menulist you select the style in which you want to provide the target definition. Two styles are available: Simple Style and XPath Style. In will come back to this in a minute.
- In this editable menulist you can modify the proposed specification of the target element. Depending on the selected element the menulist is already filled with a number of different target definitions. The one provided as the default value is suited in the most cases but sometimes you need to adapt it by choosing another one or by modifing one of them.
- Target Name
- The name is only used for displaying in the actions tree so you can better distinguish your actions.
- Target is optional in page
- If this checkbox is ticked CYW will not report an error if the target element is missing in the website.
Simple Target Defintion
The simple target defintion consists of list of name/value pairs. The syntax is quite similar to the one used in [].
The first name/value pair defines the tag of the target element (e.g. tag=INPUT). The following name/value pairs defines the values of one or more attributes. If the value of an attribute does not contain spaces you can omit the quotes.
If these defintions are not sufficient to unambiguously describe the target element a last name/value pair must define the position within the remaining elements (e.g. pos=2). The expression textfield offers a simple code completion if you press Ctrl+Space.
You get instant visual feedback to which elements the current expression refers to. All matching elements in the target window will get a frame with a number attached to it indicating the position within the result set.
In an attribute definition you can use the "*" as a wildcard character but only at the end of the value Examples:
- tag=Input value="Login*" --> OK
- tag=Input value="*out*" --> Not OK
XPath Target Defintion
The second style CYW supports to define the target element is with a XPath expression. As with the simple style a list of reasonable XPath expressions are already listed in the menulist.
You also get instant visual feedback of the target element(s) matching the current expression. If you move the cursor within the expression you also get visual feedback of the elements matching the part of XPath expression up to the position where the cursor is located. In contrast to the target elements these elements get a green frame.
In the following you find links to websites containing detailed information about XPath: