Execute JavaScript and verify the result

With the XBrowser Engine 3.0, you can execute JavaScript calls on web pages and verify the result.

Execute JavaScript

To execute JavaScript call, use the Module Execute JavaScript.

This Module is part of the Standard subset. You can find it under Standard modules->Engines->Html.

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

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

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

Verify JavaScript Result

To verify the result of a JavaScript call, use the Module Verify JavaScript Result.

This Module is part of the Standard subset. You can find it under Standard modules->Engines->Html.

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

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

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