Steer XBrowser controls

This chapter covers special requirements for steering with the XBrowser Engine 3.0. For general information on steering options for individual controls, see chapter "Control types".

Configuration parameter DisableGetElementById

This parameter helps to ensure that more than one control of the same ID is found. The parameter is generated automatically upon scanning if two or more controls share the same ID. It is created for each ModuleAttribute except for the first one. The default value is set to True.

Identify HTML elements by XPath

You can identify HTML elements by using an XPath expression and the identification parameter XPath. The parameter is available in the Transition section of the Identify by Properties grid in the XScan window.

To use XPath for identification, enable the setting Enable XPath Identification in Settings->Tbox->Engines->XBrowser.

For further information on how to specify XPaths, click here.

Use the XPath parameter for identification in Tosca XScan

Steering parameter FireEvent

You can add the steering parameter FireEvent to each control type mentioned in this chapter. To do so, specify the event handler in the Value field without the prefix on. For example, instead of onclick, specify the value click. Note that all designations are case-sensitive.

ActionMode Input always triggers an event using the default operation of the business-based control.

To add several events, separate them by semicolons, e.g. change;blur.

The availability of the events depends on the implemented controls. For detailed information on HTML events, see the following page: HTML Event Attributes.

Trigger the FireEvent change after selecting a ComboBox entry

Steering parameter FireEventMethodIE

For applications that open with Internet Explorer (out of support) and use the Microsoft specific method AttachEvent, you have to specify the steering parameter FireEventMethodIE in addition to the parameter FireEvent .

You can specify the following values for the parameter FireEventMethodIE:

Possible values for the parameter FireEventMethodIE

Value

Description

None

If you don't specify a value, the DispatchEvent is triggered. If no DispatchEvent is available, FireEvent is triggered.

FireEvent

Triggers FireEvents.

DispatchEvent

Triggers DispatchEvent .

FireEvent+DispatchEvent

Triggers FireEvent followed by DispatchEvent.

DispatchEvent+FireEvent

Triggers DispatchEvent followed by FireEvent.

Steering parameter FireEventMethodIE

Steering parameter FocusOnActivate

You can define the steering parameter FocusOnActivate on Module level for steering Microsoft Edge version 44 or older. The parameter does not work if you use Microsoft Edge version 79 or newer. Use this parameter if the currently loaded page in Microsoft Edge should be focused after activating the browser window. For example, if a control in the browser toolbar has the focus, you can use FocusOnActivate to prevent the user-simulated keyboard from failing.

Alternatively, you can define FocusOnActivate as a test configuration parameter.

Steering parameter SyncStateInteractive

By default, the XBrowser Engine 3.0 only executes on a website if its loading status (document.readyState) is complete. You can specify that the XBrowser Engine 3.0 should also execute on a website whose loading status is interactive. To do so, specify the steering parameter SyncStateInteractive and set its value to false.

Note that the steering parameter SyncStateInteractive works only with Internet Explorer (out of support).

Alternatively, you can define SyncStateInteractive as a test configuration parameter./

Steering parameter AllowedAriaControls

Specify a list of ARIA elements Tosca interacts with during execution. Tosca ignores any elements missing from this list.

Tosca automatically fills in this steering parameter for new Modules according to the IgnoreAriaControls setting.

Steering parameter IgnoreAriaControls

Specify if you want Tosca to ignore all or specific ARIA elements during execution. We recommend you set this to True if you have issues with compatibility and XBrowser customizations.

Tosca can automatically add this steering parameter to new Modules with the IgnoreAriaControls setting.

Note that all Modules created with Tosca version 26.1 use the AllowedAriaControls parameter instead of this. Tosca version 26.1 is backwards compatible with modules that use the IgnoreAriaControls parameter.

Alternatively, you can define IgnoreAriaControls as a test configuration parameter.

Steering parameter EnableSlotContentHandling

Specify whether to display controls as children of their assigned slot element.

Tosca automatically adds this steering parameter to new Modules and sets it to either True or False, based on the configuration of the Enable slot content handling setting.

Note that in Modules created in Tosca versions older than 2024.1, the steering parameter isn't visible, which means it's set to True. If you want to change it and display controls as they are in the DOM structure, manually add the steering parameter EnableSlotContentHandling and set it to False.

Technical property IsSteerable

The technical property IsSteerable verifies whether the control can be steered, if not specified otherwise in the individual controls.

From a technical point of view, the engine verifies whether the property CurrentStyle.Display has a value different from none, and whether the property CurrentStyle.Visibility has a value different from hidden.

Identify HTML elements by CSS style properties

You can identify HTML elements by using CSS style properties. Style properties start with style_.

To load the style properties of a control, select the control in Tosca XScan, click the More button, and select Load all.

Identify control by style properties

You can also use CSS style properties verification, WaitOn, and buffering.

Steer input controls with specially formatted data

To steer some HTML elements with input tag, you need specially formatted data. The expected format is independent of the data formats that you define in Settings.

The following table lists the HTML elements with input tag for which you need specially formatted data.

Value of type attribute

Data type

Expected format*

Example

date

String

yyyy-MM-dd

2012-03-20

time

String

HH:mm or HH:mm:ss or HH:mm:ss.SSS

20:15 or 20:15:03

datetime-local

String

yyyy-MM-ddTHH:mm

2012-03-20T20:15

month

String

yyyy-MM

2012-03

week

String

yyyy-Www

2013-W04

color

String

#<hexadecimal color code>

#45AE3B

range

String

Any number.

Use a decimal separator that conforms to the localization of your machine.

3 or 3.14 or 31.4E-1

* To specify date and time, this column uses the standard Tosca Commander notation.

If you steer time-related controls (date, time, datetime-local, month, or week) with an empty value, Tosca Commander clears the value of the HTML element.

Scan hidden input fields

You can scan and verify an input element with type attribute set to hidden. To do this, make sure that the setting Settings->TBox->Engines->Ignore invisible HTML elements is set to False. You cannot change the content of hidden input elements.

Technical click operations without using the mouse

You can perform left-click operations on every HTML control with the TestStepValue {CLICK}. This instructs the system to perform an actual left-click operation using the mouse.

You can instruct the system to perform technical left-click operations without using the mouse. This is more stable than {CLICK}, improves test performance, and allows you to perform click operations even if the machine is locked.

You can perform technical left-click operations in one of the following ways:

  • Perform technical left-click operations on Buttons, RadioButtons and Containers with the TestStepValue X. It instructs the system to verify whether the control is enabled and to perform a left-click without using the mouse.

  • Perform technical left-click operations on every HTML control with the TestStepValue {Invoke[Click]}. It instructs the system to perform a left-click without using the mouse, but it does not verify whether the control is enabled.

Technical properties

The following table lists all the technical properties of the XBrowser Engine. The column Control Type shows the control types that the property is available to. You can use these properties in TestStepValues in the Value column.

Technical properties

Property Name

Data Type

Control Type

ClassName

String

All html elements

Id

String

All html elements

InnerHtml

String

All html elements

InnerText

String

All html elements

OuterHtml

String

All html elements

OuterText

String

All html elements

Tag

String

All html elements

Title

String

All html elements

Href

String

Anchor element

Disabled

Boolean

Button element

Value

String

Button element

ColSpan

Numeric

Table Cell (TH, TD)

RowSpan

Numeric

Table Cell (TH, TD)

Title

String

Html Document

Url

String

Html Document

ReadyState

String

Html Document

Src

String

(I)Frame element

Name

String

(I)Frame element

Src

String

Image (Img) element

Alt

String

Image (Img) element

Checked

Boolean

All input elements

Disabled

Boolean

All input elements

Name

String

All input elements

Type

String

All input elements

Value

String

All input elements

ReadOnly

Boolean

All input elements

Selected

Boolean

ListItem (Option element)

Value

String

ListItem (Option element)

Multiple

Boolean

ComboBox, ListBox (Select element)

Name

String

ComboBox, ListBox (Select element)

Disabled

Boolean

ComboBox, ListBox (Select element)

SelectedIndex

Numeric

ComboBox, ListBox (Select element)

Size

Numeric

ComboBox, ListBox (Select element)

ReadOnly

Boolean

Textarea element

Disabled

Boolean

Textarea element

Value

String

Textarea element

Name

String

Textarea element

Cols

Numeric

Textarea element

RowSpan

Numeric

Textarea element

DefaultValue

String

Textarea element

User-defined properties

After XScan has finished, you can load user-defined properties in the Properties window. Property names in Tosca TBox consist of the original user-defined property name and the prefix attributes_, e.g. attributes_<Name>.

You can use user-defined properties loaded from the XScan window for verify operations in the Value column of TestStepValues.

Specific control types of the XBrowser Engine

The following control types are HTML-specific. The default behaviors apply to control types for which no property has been specified in the Value column.

HTML-specific representation types

Icon

Control type

Business- based property

Default behavior

HtmlDocument

Title

Input operations: none

Reading operations:
property Title

HtmlFrame

None

None

CheckBox

The control CheckBox is identified if the INPUT tag exists and the attribute Type has the value checkbox.

Technical properties

Technical properties

Technical property

Description

Label

Returns the technical property InnerText or Value.

Selected

Setter:
Sets the technical property Checked to the desired value and executes the specified FireEvents.

Getter:
Returns the value of the technical property Checked.

IsSteerable

Executes the standard validation. In addition, it verifies whether the technical properties Disabled and ReadOnly of the Html element have the value false.

Example

<input type="checkbox" id="checkBox1" value="checkBox1Value" onclick="javascript:testControlClick(event, this, 'onclick-Event on type=checkbox &amp; id=checkBox1'>

ComboBox

The control ComboBox is identified if the tag SELECT exists and if the Attribute Multiple has the value false. The Attribute Size must not have a value greater than 1.

Technical properties

Technical property

Technical property

Description

IsSteerable

Negates and returns the technical property Disabled.

Example

<select name="select" id="select1" size="1" onchange="javascript:testControlClick(event, this, 'onchange-Event on type=select &amp; id=select1');">
  <option id="c0">Alpha</option>
  <option id="c1">Bravo</option>
  <option id="c2">Charlie</option>
  <option id="c3">Delta</option>
  <option id="c4">Echo</option>
</select>

Container

The control Container is identified if one of the following tags exists:

Tag

DIV

SPAN

FIELDSET

Example

<div />

GenericGUI

The control GenericGUI represents controls which are identified as not technical. The control GenericGUI is identified if there's a tag that's not paired with any other dedicated controls listed in this topic. For example, GenericGUI is applied to the following tags ADDRESS, DATA, LABEL, etc.

GenericGUI controls appear as question mark boxes in Tosca.

HtmlDocument

The control HtmlDocument describes an HTML document which can be located within the control HtmlFrames.

Technical properties

Technical property

Technical property

Description

Title

Returns the technical property Title.

HtmlFrame

The control HtmlFrame can have HtmlDocument controls as child elements. The control HtmlFrame is identified if one of the following tags exists:

Tag

FRAME

IFRAME

OBJECT

Note that the usage of HtmlFrame controls leads to changes of context.

Example

<frame name="normal" src="abc.html"/>
<iframe name="inner" src="abc.html"/>
<object name="embeddeddoc" data="abc.html"/>

If you use Chrome as a browser, you can specify the following parameter so that cookies are stored for local websites:

--enable-file-cookies

With Chrome 34 or earlier, you might encounter problems if frames are used that point to other sites. This problem can be solved by starting Chrome with the following start parameter:

--disable-web-security

Image

The control Image is identified if the tag IMG exists.

Technical properties

Technical property

Technical property

Description

Picture

Specifies the path to the corresponding image (technical property src).

Example

<img alt="ABC" src="abc.png"/>

Number

The control Number is identified if the INPUT tag exists and if the Attribute Type has the value number.

Example

<input type="number" name="quantity" min="1" max="5">

PushButton

The control PushButton is identified if one of the following tags exists:

Tag

BUTTON

INPUT*

*Provided that the Attribute Type has the value submit, reset, button, or image.

Technical properties

Technical property

Technical property

Description

Label

Returns the technical property InnerText (for BUTTON) or Value (for INPUT).

Technical ActionMode Push

The Technical ActionMode Push executes a DOM click followed by the specified FireEvents.

Example

<button id="button1" onclick="javascript:testControlClick(event, this, 'clicked on element=button');">Button</button>

ShadowDOM

ShadowDOMs are steered like HtmlFrames and are supported in open and closed mode in Google Chrome, Microsoft Edge Chromium and Mozilla Firefox. If you have disabled the ShadowDomUnlocker injection on a webpage, ShadowDOMs are only supported in open mode.

Table

The control Table is identified if the TABLE tag exists.

Steering parameter HeaderTable

By default, tables have the steering parameters HeaderRow and HeaderColumn. However, you can override these steering parameters to customize a table with a header row or column from another table. To specify a header that belongs to another table, which we'll call the header table, follow these steps:

  1. Create a Module by scanning both the header table and the table you want to add the header to, which we'll call the target table.

  2. Go to the target table and add a steering parameter named HeaderTable.

  3. In the Value field of HeaderTable, insert the header table's UniqueId.

  4. Delete these steering parameters from your target table: HeaderRow, HeaderColumn, RowCount, ColumnCount, ColumnNumber, RowNumber, RawColumnNumber, or RawRowNumber.

Also, keep these things in mind:

  • The header table in the same TestStep must use ActionMode Select.

  • Importing Modules generates a different UniqueId. This means that when you import Modules, you need to adapt the HeaderTable steering parameter accordingly.

  • The header row or column goes into the index it is assigned in the header table. For example, if the HeaderRow of the header table is 2, the header appears as the 2nd row in the target table.

    Note that if the index exceeds the number of rows or columns in the target table, the header appears as the last row or column.

Let's say you have these tables in your TestStep:

  • A target table with 3 columns (1, 2, 3) and 2 rows (A, B).

  • A header table with 3 columns (1, 2, 3) and 3 rows (H, X, Y). Its UniqueId is 3a13b42d-24a3-c69d-ab22-4d1f5d196446 and its HeaderRow value is 2.

Header and target tables example

You add the HeaderTable steering parameter to your target table with the value 3a13b42d-24a3-c69d-ab22-4d1f5d196446 to use the headers from the header table.

Steering parameters of the target table

Steering parameters of the header table

Since the HeaderRow of the header table is 2, the second row (X) from the header table appears in the target table in the second position. This means your target has now 3 columns (1, 2, 3) and 3 rows (A, X, B).

Resulting target table

Then, you create the TestStep Verify values in the target table to successfully verify some of the attributes.

Verification of different table attributes