This chapter lists technical information, in addition to the preceding documents about the query API.
HTML Attributes and Properties
You can use the condition to check the regular HTML attributes and properties. The following attribute names are supported:
id
: ID of the HTML element
tag
: tag of the HTML element
innerText
(*): value of the innerText
property of the HTML element
value
(*): value attribute of the HTML element
readOnly
(*): value of the readOnly
attribute as a Boolean
disabled
(*): Boolean value of the disabled
attribute as a Boolean
class
: list of styles applied to the HTML element
className
: same as class
href
: href
attribute of a link, that is, of the anchor HTML element
Caution
(*) Some HTML attributes may not reflect the visual aspect of the Web controls, depending on the UI technology. For instance, the UI technologies do not necessarily rely on a disabled HTML attribute to enable or disable a control, so the disabled attribute is meaningless. In such a situation, another attribute that is specific to the underlying UI technology) can provide the information.
WebCUIF Attributes
The WebCUIF attributes that can be used to test CRM applications start with the prefix crm.
. The following attributes are supported:
crm.value
: value of the CRM Web control
The underlying HTML attribute used to retrieve the information can vary, depending on the UI element type. For instance, the value HTML attribute is returned for input HTML elements, but the innerText
HTML attribute is used instead for texts and labels.
crm.id
: CRM ID of the CRM Web control
This ID is unique within the HTML content. It has a CRM-specific syntax, and provides the following information:
A_
fragment: specifies the application
V_
fragment: specifies the view name
T_
fragment: specifies the type
C_
fragment: specifies the context node
I_
fragment: is the interface (optional); for input fields, the technical name of the field
R_
fragment: provides the row number (optional)
K_
fragment: provides the key (optional)
crm.type
: type of the CRM Web control
This type corresponds to the T_
fragment of crm.id
. It is independent of the internal HTML tag that is used to render the UI element. For example, the inputField
type is used for checkboxes.
crm.tagType
: tag type or subtype depending on the UI element type.
CRM Web controls of typeinputField
can have the following tagType
settings:
checkbox for checkbox controls
dropdownListBox for combo box controls
valueHelp for input fields with F4 help
crm.application
: A_
fragment of the crm.id
crm.view
: V_
fragment of the crm.id
crm.context
: C_
fragment of the crm.id
crm.interface
: I_
fragment of the crm.id
crm.row
: R_
fragment of the crm.id
crm.key
: K_
fragment of the crm.id
crm.column.title
: title of the column that contains the CRM Web control, if there is an R_
fragment
crm.wrongName
: returns [wrongName]
to indicate an unexpected attribute name that is passed as input parameter
crm.column:<field>
: value of the cell that contains the field specified by the <field>
fragment
The <field>
fragment provides the technical name of a field that is displayed by the cell. It must be in the format <context>.<interface>.
crm.column~<title>
: value of the cell that is displayed by the column with <title>
in its column header
Light Speed Attributes
Applications based on the URI Light Speed framework generate controls that include some meta information, which can be used by queries to search for controls:
ls.type
: type of the control
ls.subtype
: the subtype of the control (if any)
ls.id
: ID of the HTML element for the best current control
ls.value
: value of the HTML element for the best current control
ls.value
: tag of the HTML element for the best control
Web Dynpro ABAP Attributes
The following attributes are available only when you test applications that were developed in Web Dynpro ABAP. They provide further information about the fields:
ls.component
: name of the component to which the control belongs
ls.application
: (alias) same as ls.component
ls.view
: technical name of the view to which the control belongs
ls.field
: technical name of the field in the corresponding view
ls.row
: row number (if the control is embedded in a table)
ls.column.title
: title of the column that contains the control if the control is embedded in a table
ls.column:<field>
: value of the cell that contains the field specified by the <field>
fragment.
The <field>
fragment provides the technical name of the field that is displayed by the cell.
ls.column~<title>
: value of the cell that is displayed by the column with <title>
as its column header
Light Speed Data
Light Speed Controls have an HTML attribute that provides additional meta information: the ls.data
attribute. This information is parsed and made available to the test framework as Light Speed attributes that can be used to define conditions. Not all Light Speed attributes are provided here, because each control can have a different set of data, depending on its nature. You can use the object spy to look for a control, and see the data that is available.
The following are common Light Speed attributes:
ls.data.value
: value of the control
ls.data.state
: state of the control, for example checked for a checkbox
ls.data.enabled
: defines whether the control is enabled (true or false)
ls.data.readonly
: defines whether the control value can be modified (true or false)
ls.data.text
: text of the control
This is usually similar to the innerText
HTML attribute, but when the control is complex, theinnerText
attribute may return a multi-line value (including carriage return characters).
ls.data.text
: tooltip associated with the control
The Query API supports the following operators when you define conditions.
=
: equal to
==
: same as =
<>
: not equal to
!=
: same as <>
<
: less than
<=
: less than or equal to
>
: greater than
>=
: greater than or equal to
{contains}
: contains
{startsWith}
: starts with
{endsWith}
: ends with
{matches}
: value matches a regular expression; regular expressions use the C# syntax.
For most of the attributes, the conditions compare operand values as strings, and the comparison is case-sensitive, as in the following example:
filter.AddCondition "crm.column~Partner Function", "=", "Sales employee"
The script may need a case-insensitive comparison. In that case, an additional parameter specifies condition options. Example:
filter.AddCondition "crm.column~Partner Function", "=", "SaLeS EmPlOYee", "/u"
With the /u
option, both values are converted to upper-case before they are compared.
These are the available options:
/u
: upper-case. Non-case-sensitive comparison. Both operand values are converted to upper-case before they are compared.
/t
: trimmed. Both operand values are trimmed, to remove heading and trailing spaces, before they are compared.
/b
: Boolean. Both operand values are converted to a Boolean value (true
or false
) before they are compared. This option is implicit for boolean attributes such asreadOnly
anddisabled
/i
: integer. Both operand values are converted to an integer before they are compared. The value is not truncated; for example, the value 10.50 is converted to 11.
/f
: float. Both operand values are converted to float before they are compared.
Web Controller Interface
The Web controller interface is the main entry point to test Web applications. It exposes the following methods:
CreateQuery
: creates a query object to search the HTML content for Web controls
CreateWebQuery
: same as CreateQuery
method of the Web controller
GetWebControlByUri
: resolves the URI parameter and returns the corresponding Web control (if any)
GetElementByUri
: resolves the URI parameter and returns the corresponding HTML element (if any)
Web Query Interface
The Web query interface is the main interface of all query objects. It exposes the following methods:
SetFilter
: removes all filters and defines the first one
Input parameters: none. Use the SetCondition
and AddCondition
methods to define the criteria.
AddFilter
: adds an additional filter
Input parameters: none. Use the SetCondition
and AddCondition
methods to define the criteria.
SelectSingle
: resolves the query and returns the first Web control that matches the criteria
Select
: resolves the query and returns a set of Web controls
Input parameters: maxHits
(optional), specifies the maximum number of controls to return. See also Iterating through a Collection of Web Controls
.
GetMainControl
: resolves the ParentControlUri
(if specified) and returns the corresponding Web control
It also exposes the following properties:
ParentControlUri
: defines the scope of the search for controls
Its value is the URI of the parent container that is to be searched. When it is empty, the query searches the main document of the main page. See also Reducing the Scope of a Query
and Searching for Web Controls in a Popup Window
.
Web Filter Interface
A filter object that contains a list of conditions that specify the criteria that the controls have to match, and that can have sub-filters that specify additional criteria.
SetCondition
: removes all conditions (if any) and defines the first one.
Input parameters:
AttributeName
: attribute name (or the property name)
BooleanOperator
: operator to use to evaluate the condition
Value
: expected value
Options
: conversion options
See also Attribute Names and Property Names
, Boolean Operators
, and Options for Conditions
.
AddCondition
: adds a condition
Input parameters: same as for SetCondition
.
RemoveAllConditions
: removes all conditions (if any)
SetFilter
: removes all sub-filters and defines the first one
Input parameters: none. Use the SetCondition
and AddCondition
methods to define the criteria.
See also Combining Filters for Complex Queries
.
AddFilter
: adds an additional sub-filter
Input parameters: none. Use the SetCondition
and AddCondition
methods to define the criteria.
RemoveAllFilters
: removes all filters (if any)
Web Condition Interface
Conditions are defined using the SetCondition
and the AddCondition
methods of the Web filter interface. The condition object that is created exposes the following properties:
AttributeName
: name of the attribute or property that is used by this condition
BooleanOperator
: operator that is used to evaluate this condition
Value
: expected value of the attribute or property
Option
: options that are used to evaluate this condition
Web Control Interface
The Web control interface provides access to the HTML attributes and properties of the underlying HTML element. It exposes the following methods:
GetHtmlElement
: returns the underlying HTML element
The object returned here implements Microsoft interfaces, depending on its nature.
GetControlUri
: returns the URI of the control in the current HTML content
This URI can be used to call a default component implementation, to simulate user actions such as a mouse click.
GetAttribute
: returns the value of an HTML attribute of the underlying HTML element
Input parameters: AttributeName
. Name (value) of the attribute.
GetProperty
: returns the value of an HTML property of the underlying HTML element
Input parameters: PropertyName
. Name (value) of the property (for exampleinnerText
).
HighLight
: highlights the HTML element at runtime, for troubleshooting
Input parameters: ColorName
. The color that is used to highlight the control property (for example innerText
), for example red, green, or blue.
FindFirstChildElement
: searches for a child control
Input parameters:
TagName
: HTML tag to search for, for example SPAN
Recurse
(optional): true to search recursively in the HTML DOM
hierarchy of HTML elements
FindLastChildElement
: searches for the latest child control
Input parameters:
TagName
: HTML tag to search for, for example SPAN
Recurse
(optional): true to search recursively in the HTML DOM
hierarchy of HTML elements
FindChildElementAtPosition
: searches for a child control at a position (index)
Input parameters:
TagName
: HTML tag to search for, for example SPAN
Index
: position number in the set of children
Recurse
(optional): true to search recursively in the HTML DOM
hierarchy of HTML elements
FindChildElements
: returns a collection of child controls
Input parameters:
TagName
: HTML tag to search for, for example SPAN
Recurse
(optional): true to search recursively in the HTML DOM
hierarchy of HTML elements
Web Control Collection Interface
The set of Web controls is the result of the query that is called by the Select
method. The test script can iterate through the set with the following methods and properties:
ControlAt
method: returns the Web control at the specified position
Input parameters: Index
. The position number in the set of Web controls.
See also, Iterating through a Collection of Web Controls
.
Count
property (read-only): number of controls in the set
Operation Result Interface
Interface that provides results when you call a default component implementation. It has the following properties.
Status
(read-only): DONE, PASSED, WARNING, or FAILED
Feedback
(read-only): message that provides feedback about the operation that was performed
Value
(read-only): output value of the operation
Comment
(read-only): additional information (optional)
ImageTitle
(read-only): title of the screenshot (if any)
ImagePath
(read-only): path to the screenshot (if any)
OutputParameters
(read-only): set of output parameters
CRM Controller Interface
The controller interface for CRM exposes the following methods:
CreateCrmQuery
: creates a query object to search the HTML content for CRM controls
CreateQuery
: same as CreateCrmQuery
method when using this CRM controller
CreateWebQuery
: same as CreateQuery
method of the Web controller
GetWebControlByUri
: resolves the URI parameter and returns the corresponding CRM control (if any)
CRM Query Interface
The CRM query interface exposes the same methods as the Web query interface that it extends, but the it returns WebCUIF controls instead of regular Web controls.
CRM Control Interface
The CRM control interface extends the Web control interface. It inherits capabilities from the Web control interface. It exposes the following, additional methods:
GetTestModeControl
: returns the control that provides meta information about the CRM control
This control is usually a hidden SPAN
element that the WebCUIF framework inserts in the HTML content when CRM applications run in test mode.
GetTestModeElement
: returns the SPAN
element providing meta information about the CRM control
CRM Test Mode Control Interface
This interface provides access to the meta information that the WebCUIF framework inserts into the HTML content when CRM applications are running in test mode.
Method Name | Description | Equivalent when Filtering |
---|---|---|
GetCrmId | returns the ID of the control | crm.id |
GetCrmType | returns the type of the control ( | crm.type |
GetCrmTagType | returns the subtype of the control, as defined by the | crm.tagType |
GetApplication | returns the application to which the control belongs ( | crm.application |
GetViewName | returns the view the control belongs to ( | crm.application |
GetCrmContext | returns the context the control belongs to ( | crm.context |
GetCrmInterface | returns the technical name of the control | crm.context |
GetCrmRow | returns the row number when embedded in a cell in a table | crm.context |
GetCrmKey | returns the key of the control when child item of a dropdown list box | crm.key |
Light Speed Controller Interface
The controller interface for Light Speed exposes the following methods:
CreateLsQuery
: creates a query object to search the HTML content for Light Speed controls
Input parameters: Options
. Activates default filtering on common attributes, to restrict the number of elements found by the query.
/all
: returns all HTML elements that are child of a Light Speed control. This is the default value.
/ls
: returns all Light Speed elements, which have a ct
or subct
attribute.
/ct
: returns all Light Speed elements with a ct
attribute
/subct
: returns all Light Speed elements with a subct
attribute
/web
: returns all HTML elements, even those that are not children of a Light Speed control
Note: The option chosen here impacts the performance of a query.
CreateQuery
: same as the CreateLsQuery
method when using this Light Speed Controller
CreateWebQuery
: same as the CreateQuery
method of the Web controller
GetWebControlByUri
: resolves the URI parameter and returns the corresponding WebCUIF control, if any
Light Speed Query Interface
The Light Speed query interface exposes the same methods as the Web query interface that it extends, but the query returns objects that implement the Light Speed controls instead of Web controls.
Light Speed Control Interface
The Light Speed Control interface extends the Web control interface. It inherits capabilities from the Web control interface. It exposes the following, additional methods:
GetRelevantControl
: returns the relevant
control, the one with HTML attributes (such as ct
or subct
), which define the control type
GetRelevantElement
: returns the relevant
element, the underlying HTML element of the relevant control, the one with HTML attributes (such as ct
or subct
), which define the control type
Light Speed Relevant Control Interface
The relevant
control interface only makes the access to some meta information easier, that the Light Speed framework provides.
Method Name | Description | Equivalent when Filtering |
---|---|---|
GetLsId | returns the ID of the control | ls.id |
GetLsTag | returns the tag of the underlying HTML element | ls.tag |
GetLsType | returns the type of the control | ls.type |
GetLsSubtype | returns the subtype of the control | ls.subtype |
GetLsComponent | returns the component of the control (only Web Dynpro ABAP) | ls.component |
GetLsViewName | returns the view of the control (Web only Dynpro ABAP) | ls.view |
GetLsFieldName | returns the name of the control (only Web Dynpro ABAP) | ls.field |
GetLsRow | returns the row number (when embedded in a cell in a table) | ls.row |