HTML Modules

The folder TBox XEngines->Html in the Standard subset contains Modules that perform specific tasks for the XBrowser Engine 3.0.

The Html folder also contains sub-folders with additional Modules:

Accessibility

Web accessibility testing is an early access feature and still under development. We can't guarantee full functionality in this or future versions.

Note that to use this early access feature, first you need to enable it.

The Module Accessibility allows you to test how user-accessible your web application is. To learn how to use it, check out the Web accessibility testing.

It has the following ModuleAttributes:

ModuleAttribute

Description

Title

Caption of the browser window that you want to steer.

Specify an * value to match any title. For example, if you want XBrowser Engine 3.0 to find and use the only tab open in your browser window, enter *.

Url

URL of the browser window you want to steer. For example, http://support.tricentis.com.

Window Index

Index of the browser window you want to steer, in case multiple browser windows match the previous criteria.

Specify one of these values:

  • <integer>: this index only refers to the opening time of the windows, not their visual order.

  • last: this value refers to the last window you opened.

In this example, the XBrowser Engine 3.0 searches for the open browser window that has a Title starting with Tricentis, https://support-hub.tricentis.com/ as the URL, and a Window Index of 2.

Once it finds the correct browser window, the XBrowser Engine 3.0 runs an accessibility test on it.

Example - Accessibility

Execute JavaScript

The Module Execute JavaScript allows you to execute JavaScript calls on web pages.

It has the following ModuleAttributes:

ModuleAttribute

Description

Title

Caption of the browser window that you want to steer.

Specify an * value to match any title. For example, if you want XBrowser Engine 3.0 to find and use the only tab open in your browser window, enter *.

Url

URL of the browser window you want to steer. For example, http://support.tricentis.com.

Window Index

Index of the browser window you want to steer, in case multiple browser windows match the previous criteria.

Specify one of these values:

  • <integer>: this index only refers to the opening time of the windows, not their visual order.

  • last: this value refers to the last window you opened.

JavaScript

Return statement that you want to execute.

If the string contains double quotation marks ", you must escape the string with two additional sets of quotation marks.

For example: window.location.href="""http://support.tricentis.com"""

You need to specify at least one of the Search Criteria: Title, Url, or Window Index.

In this example, the XBrowser Engine 3.0 searches for the open browser window that has a Title starting with Tricentis, https://support-hub.tricentis.com/ as the URL, and a Window Index of 2.

Once it finds the correct browser window, it redirects it to https://support-hub.tricentis.com/open.

Example - Execute JavaScript

Verify JavaScript Result

The Module Verify JavaScript Result allows you to verify the result of a JavaScript call. For example, you can retrieve and verify the values of browser cookies and JavaScript variables.

It has the following ModuleAttributes:

ModuleAttribute

Description

Title

Caption of the browser window that you want to steer.

Specify an * value to match any title. For example, if you want XBrowser Engine 3.0 to find and use the only tab open in your browser window, enter *.

Url

URL of the browser window you want to steer. For example, http://support.tricentis.com.

Window Index

Index of the browser window you want to steer, in case multiple browser windows match the previous criteria.

Specify one of these values:

  • <integer>: this index only refers to the opening time of the windows, not their visual order.

  • last: this value refers to the last window you opened.

JavaScript

Type return and the JavaScript statement whose result you want to verify.

If the string contains double quotation marks ", you must escape the string with two additional sets of quotation marks.

For example: document.cookie

Result

The expected return value of the JavaScript call.

You need to specify at least one of the Search Criteria: Title, Url, or Window Index.

In this example, the XBrowser Engine 3.0 searches for the specific browser window that matches the following criteria:

  • Its Title starts with Tricentis.

  • Its URL is https://support-hub.tricentis.com/.

  • Its Window Index is 2.

Once found, it retrieves the cookies and verifies that the value returned is username-Jane Doe; language=en-US.

Example - Verify JavaScript result

OpenUrl

The Module OpenUrl allows you to open websites in a browser.

It has the following ModuleAttributes:

ModuleAttribute

Description

Url

URL that you want to open.

If you want to specify the browser, use the test configuration parameter Browser (see chapter "Specify the browser").

UseActiveTab

If you set this ModuleAttribute to True, Tosca Commander looks for an open browser window when it executes the TestStep based on this Module. If it finds an open browser, it opens the URL in the active tab of this browser. If Tosca Commander cannot find an open browser, it opens the URL in a new browser window.

If this ModuleAttribute is set to False or empty, Tosca Commander opens the URL in a new browser window.

If you execute your TestCase via WebDriver, this setting has no effect.

WebDriverBrowserArguments

Read-only. You can't enter anything here.

WebDriverBrowserArguments->Argument

If you execute your TestCase via WebDriver, you can add command line arguments to start your browser. These arguments are different for each browser. Add each argument in a separate TestStepValue.

The XBrowser Engine 3.0 doesn't validate whether the URL you entered is accessible. Even if the URL is unreachable, the TestStep passes.

If you want to use arguments with Internet Explorer, set the registry key TabProcGrowth with value 0 in HKLM_CURRENT_USER\Software\Microsoft\Internet Explorer\Main.

In this example, you open the URL https://support.tricentis.com . If a browser window is already open, Tosca Commander opens the page in the active tab of this window. You do not pass any command line arguments.

Open a website

Open embedded Chrome/Chromium application

The Module Open embedded Chrome/Chromium application allows you to open applications that embed Chrome or Chromium with WebDriver.

For information on how to steer these applications, see chapter "Automate embedded Chrome or Chromium".

The XBrowser Engine 3.0 only supports local execution via WebDriver.

The Module has the following ModuleAttributes:

ModuleAttribute

Description

Application Path

Full path to the application that you want to steer, including file name and extension.

Window Classname

Class name of the main application window.

This ModuleAttribute is optional. It speeds up the search for the application window.

WebDriver Server Path

Path to the chromedriver.exe that you want to use.

This ModuleAttribute is optional. If you don't specify a path, the XBrowser Engine 3.0 uses the default server.

Url

URL that you want to display after the application is opened.

This ModuleAttribute is optional.

Arguments

Read-only. You can't enter anything here.

Arguments->Argument

Argument that you want to transfer to the application.

This ModuleAttribute is optional.

This example shows how to open an embedded Chromium application.

The XBrowser Engine 3.0 below performs the following actions:

  • It opens the application SampleApp.exe, located at F:\SampleApp.

  • It uses the chromedriver.exe located at F:\Webdriver\EmbeddedChromiumApplication.

Open a Chromium application

ClickOnScreen

The Module ClickOnScreen allows you to click onto a specified position in your browser tab (see chapter "Click on a browser screen position").

It has the following ModuleAttributes:

ModuleAttribute

Description

Caption

Caption of the tab in which you want to perform the click.

X

Specify the x-coordinate in percent. leftmost value is 0 and the rightmost value is 100.

Y

Specify y-coordinate in percent. The top value is 0 and the bottom value is 100.

In this example, the XBrowser Engine 3.0 performs the following actions:

  • It opens the URL http://sampleapp.tricentis.com/101/index.php. This browser tab has the caption Tricentis Vehicle Insurance.

  • It performs a click of 30% along the X-axis and 70% along the Y-axis, calculated from the top left corner of the screen.

Click on a certain screen position

CloseBrowser

The Module CloseBrowser allows you to close tabs in your browser.

It has the following ModuleAttribute:

ModuleAttribute

Description

Title

Caption of the tab that you want to close. You can use wildcards.

If you have the tab open in several browsers, but only want to close it in one of them, use test configuration parameter Browser (see chapter "Specify the browser").

If you use WebDriver, use test configuration parameter HubAddress to only close tabs opened for the specified WebDriver hub address.

This example shows how to close a browser tab.

This browser tab has the caption Tricentis Vehicle Insurance. Instead of typing out the entire caption, you use a wildcard.

Close browser tab

Since you only want to close the tab in Chrome, you create the test configuration parameter Browser with the value Chrome for your TestCase.

Specify in which browser you want to close the tab

Connect to Chrome/Chromium application

The Module Connect to Chrome/Chromium application allows you to connect to applications that embed Chrome or Chromium with WebDriver.

For information on how to steer these applications, see chapter "Automate embedded Chrome or Chromium".

The XBrowser Engine 3.0 only supports local execution via WebDriver.

The Module has the following ModuleAttributes:

ModuleAttribute

Description

Debug Port

Debug port under which the application runs.

WebDriver Server Path

Path to the chromedriver.exe that you want to use.

This ModuleAttribute is optional. If you don't specify a path, the XBrowser Engine 3.0 uses the default server.

Window Classname

Class name of the main application window.

This ModuleAttribute is optional. It speeds up the search for the application window.

In this example, you connect to an embedded Chromium application.

The XBrowser Engine 3.0 performs the following actions:

  • It connects through the debug port 9222.

  • It uses the chromedriver.exe located at C:\WebdriverServer\Chrome 2.38.

Connect to a Chrome/Chromium application

Start HTML Log Monitoring

The Module Start HTML Log Monitoring allows you to start tracking either the console logs or the network logs. You can use this feature as you debug your application.

This Module only supports Google Chrome and Microsoft Edge browsers.

To steer your application via XBrowser, both Modules Start HTML Log Monitoring and Stop HTML Log Monitoring must be in the same TestCase.

The Module has the following attributes:

ModuleAttribute

Description

Title

Caption of the browser window that you want to steer.

Specify an * value to match any title. For example, if you want XBrowser Engine 3.0 to find and use the only tab open in your browser window, enter *.

Url

URL of the browser window you want to steer. For example, http://support.tricentis.com.

Window Index

Index of the browser window you want to steer, in case multiple browser windows match the previous criteria.

Specify one of these values:

  • <integer>: this index only refers to the opening time of the windows, not their visual order.

  • last: this value refers to the last window you opened.

Log Type

Type of log monitoring to perform on the page you want to steer.

Specify one of these values:

  • Console logs that refer to the console tabs in the browsers DevTools.

  • Network logs that refer to the logged messages in the network tabs of the browsers DevTools.

You need to specify at least one of the Search Criteria: Title, Url, or Window Index.

Additionally, for executions over a Selenium Grid server version older than 4.8.2, you need to start the browser with an additional argument: --remote-allow-origins=*.

In this example, the XBrowser Engine 3.0 searches for the specific browser window that matches the following criteria:

  • Its Title starts with Tricentis.

  • Its URL is https://support-hub.tricentis.com/.

  • Its Window Index is 2.

Once found, it starts its Console log monitoring.

Example - Start HTML Log Monitoring

Stop HTML Log Monitoring

The Module Stop HTML Log Monitoring allows you to stop tracking either the console logs or the network logs you previously started and retrieve the monitoring data. You can use this feature as you debug your application.

This Module only supports Google Chrome and Microsoft Edge browsers.

To steer your application via XBrowser, both Modules Start HTML Log Monitoring and Stop HTML Log Monitoring must be in the same TestCase.

The Module has the following attributes:

ModuleAttribute

Description

Title

Caption of the browser window that you want to steer.

Specify an * value to match any title. For example, if you want XBrowser Engine 3.0 to find and use the only tab open in your browser window, enter *.

Url

URL of the browser window you want to steer. For example, http://support.tricentis.com.

Window Index

Index of the browser window you want to steer, in case multiple browser windows match the previous criteria.

Specify one of these values:

  • <integer>: this index only refers to the opening time of the windows, not their visual order.

  • last: this value refers to the last window you opened.

Log Type

Type of log monitoring to perform on the page you want to steer.

Specify one of these values:

  • Console logs that refer to the console tabs in the browsers DevTools.

  • Network logs that refer to the logged messages in the network tabs of the browsers DevTools.

Log File Path

Location where you want to save report files with the log entries that occurred between the start and the stop tasks. This ModuleAttribute generates different log files based on the Log Type:

  • Plain text files for Console logs.

  • JSON files for Network logs.

Specify the folder path.

You need to specify at least one of the Search Criteria: Title, Url, or Window Index.

Additionally, for executions over a Selenium Grid server version older than 4.8.2, you need to start the browser with an additional argument: --remote-allow-origins=*.

In this example, the XBrowser Engine 3.0 searches for the specific browser window that matches the following criteria:

  • Its Title starts with Tricentis.

  • Its URL is https://support-hub.tricentis.com/.

  • Its Window Index is 2.

Once found, it stops its Console log monitoring and saves the report log file in %TEMP%\NetworkLog.txt.

Example - Stop HTML Log Monitoring