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:

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.

If you want to use the first open browser window that the XBrowser Engine 3.0 finds, enter *.

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"""

In this example, the XBrowser Engine 3.0 redirects the first open browser window that it finds to the page http://support.tricentis.com.

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.

To use the first open browser window that the XBrowser Engine 3.0 finds, enter *.

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.

In this example, the XBrowser Engine 3.0 retrieves the cookies of the first open browser window that it finds 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 "Specifying 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 "Specifying 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