WebComparison Object

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

Description

The WebComparison object provides a scripting interface to the Web Comparison elements of the Stores | WebTesting collection in your TestComplete project. Using this object you can compare web pages with a baseline copy.

To obtain the WebComparison object in scripts, use properties of the WebTesting object.

Requirements

The WebComparison object is only available if the Web Checkpoints plugin is installed in TestComplete.

Members

Example

The following code obtains the WebComparison object and compares it with the web page.

JavaScript, JScript

function WebComparisonCheck()
{

  var Browser, Page, WebObject;

  // Launches the browser
  …

  // Obtains the page with which you want to compare the stored document
  Page = Browser.Page("*");
  Page.ToURL("smartbear.com");

  // Obtains the WebComparison object
  WebObject = WebTesting.WebComparison1;

  // Compares the web page with the stored HTML document
  WebObject.Check(Page);

  …

}

Python

def WebComparisonCheck():
  # Launches the browser
  # ... 
  # Obtains the page with which you want to compare the stored document 
  Page = Aliases.Browser.Page("*")
  Page.ToURL("smartbear.com")
  # Obtains the WebComparison object 
  WebObject = WebTesting.WebComparison1
  # Compares the web page with the stored HTML document 
  WebObject.Check(Page)
  # ...

VBScript

Sub WebComparisonCheck

  Dim Browser, Page, WebObject

  ' Launches the browser
  …

  ' Obtains the page with which you want to compare the stored document
  Set Page = Browser.Page("*")
  Call Page.ToURL("smartbear.com")

  ' Obtains the WebComparison object
  Set WebObject = WebTesting.WebComparison1

  ' Compares the web page with the stored HTML document
  Call WebObject.Check(Page)

  …

End Sub

DelphiScript

procedure WebComparisonCheck();
var Browser, Page, WebObject;
begin

  // Launches the browser
  …

  // Obtains the page with which you want to compare the stored document
  Page := Browser.Page('*');
  Page.ToURL('smartbear.com');

  // Obtains the WebComparison object
  WebObject := WebTesting.WebComparison1;

  // Compares the web page with the stored HTML document
  WebObject.Check(Page);

  …

end;

C++Script, C#Script

function WebComparisonCheck()
{

  var Browser, Page, WebObject;

  // Launches the browser
  …

  // Obtains the page with which you want to compare the stored document
  Page = Browser["Page"]("*");
  Page.ToURL("smartbear.com");

  // Obtains the WebComparison object
  WebObject = WebTesting["WebComparison1"];

  // Compares the web page with the stored HTML document
  WebObject["Check"](Page);

  …

}

See Also

About Web Comparison Checkpoints
WebTesting Object

Highlight search results