Using Web Comparison Checkpoints for Dynamic Web Pages

Applies to TestComplete 14.50, last modified on April 22, 2021

Dynamic web pages generate or update their contents and layout when they are loaded or interacted with. Since the hierarchy of elements of such pages and their contents change between test runs or even during a single test run, your web comparison checkpoints verifying such pages may fail.

This topic describes the specifics of creating web comparison checkpoints for dynamic web pages:

Using the Read Content From a Server Checkpoint Setting

If the contents of the web page under test are generated dynamically by server-side scripts every time the page is loaded, verification of such a page may fail since the generated contents may change between test runs.

Web comparison checkpoints in TestComplete provide the Read content from a server setting. This setting specifies whether the contents of the web page should be read from a browser's window or from the web server.

If you want to verify the original contents of a web page on the server, enable this setting. Otherwise, if you want to verify the actual contents of a web page that is currently loaded in a web browser, disable the setting. For more information on settings of web comparison checkpoints and verification actions they specify, see Web Comparison Checkpoint Settings.

Specifying Timeouts for Web Comparison Checkpoints

The contents of some web pages are generated dynamically (by scripts) after the page has been loaded to the browser. As a result, if the test starts executing a web comparison checkpoint right after the page has been loaded, it may fail because the page’s scripts may not finish generating additional contents.

By default, the checkpoint waits until the web page contents are generated for the Auto-wait timeout period (it is specified in the Playback options of the test project). You can increase this timeout to better handle web pages with dynamic contents that take some time to load.

You can also set a timeout for specific web comparison checkpoints. In keyword tests, you can do that by using the Timeout parameter of the Web Comparison Checkpoint operation.

In scripts, you can do that by using the Timeout parameter of the WebTesting.WebComparisonCheckpointName.Check method:

JavaScript, JScript

// Use 1 minute timeout for the checkpoint
WebTesting.WebComparison1.Check(Sys.Browser().Page("http://www.example.com"), 60000);

Python

# Use 1 minute timeout for the checkpoint
WebTesting.WebComparison1.Check(Sys.Browser().Page("http://www.example.com"), 60000)

VBScript

' Use 1 minute timeout for the checkpoint
Call WebTesting.WebComparison1.Check(Sys.Browser.Page("http://www.example.com"), 60000)

DelphiScript

// Use 1 minute timeout for the checkpoint
WebTesting.WebComparison1.Check(Sys.Browser.Page('http://www.example.com'), 60000);

C++Script, C#Script

// Use 1 minute timeout for the checkpoint
WebTesting["WebComparison1"]["Check"](Sys["Browser"]()["Page"]("http://www.example.com"), 60000);

Alternatively, you can modify your test to ensure that dynamic contents have finished loading before running the checkpoint. See Wait For Web Pages to learn how to do this.

Verifying Input Fields on Web Pages

Web comparison checkpoints verify the HTML markup of web elements, that is, their outerHTML property. In some web browsers, such as Mozilla Firefox and Google Chrome, the outerHTML property of INPUT fields does not include their text. As a result, web comparison checkpoints cannot verify text in the input fields.

To verify inputted values, use property checkpoints for the value attribute of the input fields.

See Also

Web Comparison Checkpoints
About Web Comparison Checkpoints
Test Dynamic Web Pages

Highlight search results