AddSEOAudits Method

Applies to TestComplete 15.70, last modified on December 17, 2024

Description

The WebAudits.For(…).AddAccessibilityAudits method adds the Accessibility audit to the web audits checkpoint and sets the threshold value for it.

Declaration

WebAuditsCheckpointObj.AddSEOAudits(ThresholdScore)

WebAuditsCheckpointObj An expression, variable or parameter that specifies a reference to a WebAuditsCheckpoint object
ThresholdScore [in]    Optional    Integer Default value: 90   
Result A WebAuditsCheckpoint object

Applies To

The method is applied to the following object:

Parameters

The method has the following parameter:

ThresholdScore

The threshold value against which the actual audit score will be compared.

Result Value

A WebAuditsCheckpoint object with the specified audit and the threshold value set for the audit.

Example

The following example shows how to add the SEO audit to a checkpoint and run the audit:

JavaScript, JScript

function VerifyWebPage(){
 var url = "http://services.smartbear.com/samples/TestComplete15/smartstore";
 var obj = WebAudits.For(url);
 obj.AddProgressiveWebAppAudits(60).Check();
}

Python

def VerifyWebPage():
 url = "http://services.smartbear.com/samples/TestComplete14/smartstore"
 obj = WebAudits.For(url)
 auditsResult = obj.AddProgressiveWebAppAudits().Query()
 if (auditsResult.ProgressiveWebAppScore < 30):
   Log.Error("Progressive web app audit failed!")
   return
 
 if (auditsResult.ProgressiveWebAppScore < 70):
   Log.Warning("Progressive web app audit passed with a warning!")
   return
 
 Log.Message("Progressive web app audit failed!")

VBScript

Sub VerifyWebPage
 url = "http://services.smartbear.com/samples/TestComplete15/smartstore"
 Set obj = WebAudits.For(url)
 obj.AddSEOAudits(70).AddProgressiveWebAppAudits(60).Check()
End Sub

DelphiScript

procedure VerifyWebPage();
var url, obj;
begin
 url :='http://services.smartbear.com/samples/TestComplete15/smartstore';
 obj := WebAudits.For(url);
 obj.AddSEOAudits(70).AddProgressiveWebAppAudits(60).Check();
end;

C++Script, C#Script

function VerifyWebPage(){
 var url = "http://services.smartbear.com/samples/TestComplete15/smartstore";
 var obj = WebAudits["For"](url);
 obj["AddSEOAudits"](70)["AddProgressiveWebAppAudits"](60)["Check"]();
}

The following example shows how to add the SEO audit to a checkpoint and run the audit:

JavaScript, JScript

function VerifyWebPage(){
 var url = "http://services.smartbear.com/samples/TestComplete15/smartstore";
 var obj = WebAudits.For(url);
 var auditsResult = obj.AddSEOAudits().Query();
 if (auditsResult.SEOScore < 30){
   Log.Error("SEO audit failed!");
   return;
 }

 if (auditsResult.SEOScore < 70){
   Log.Warning("SEO audit passed with a warning!");
   return;
 }

 Log.Message("SEO audit passed!");
}

Python

def VerifyWebPage():
 url = "http://services.smartbear.com/samples/TestComplete14/smartstore"
 WebAudits.For(url)
 auditsResult = obj.AddSEOAudits().Query()
 if (auditsResult.SEOScore < 30):
   Log.Error("SEO audit failed!")
   return
 
 if (auditsResult.SEOScore < 70):
   Log.Warning("SEO audit passed with a warning!")
   return
 
 Log.Message("SEO audit failed!")

VBScript

Sub VerifyWebPage
 url = "http://services.smartbear.com/samples/TestComplete15/smartstore"
 Set obj = WebAudits.For(url)
 Set auditsResult = obj.AddSEOAudits().Query()
 If (auditsResult.SEOScore < 30) Then
   Log.Error("SEO audit failed!")
   return
 End If

 If (auditsResult.SEOScore < 70) Then
   Log.Warning("SEO audit passed with a warning!")
   return
 End If
 Log.Message("SEO audit passed!")
End Sub

DelphiScript

procedure VerifyWebPage();
var url, obj, auditsResult;
begin
 url := 'http://services.smartbear.com/samples/TestComplete15/smartstore';
 obj := WebAudits.For(url);
 auditsResult := obj.AddSEOAudits().Query();
 if (auditsResult.SEOScore < 30) then
    begin
      Log.Error('SEO audit failed!');
      exit;
    end;


  if (auditsResult.SEOScore < 70) then
    begin
      Log.Warning('SEO audit passed with a warning!');
      exit;
    end;
   
  Log.Message('SEO audit passed!');
end;

C++Script, C#Script

function VerifyWebPage(){
 var url = "http://services.smartbear.com/samples/TestComplete15/smartstore";
 var obj = WebAudits["For"](url);
 var auditsResult = obj["AddSEOAudits"]()["Query"]();
 if (auditsResult["SEOScore"] < 30){
   Log["Error"]("SEO audit failed!");
   return;
 }

 if (auditsResult["SEOScore"] < 70){
   Log["Warning"]("SEO audit passed with a warning!");
   return;
 }

 Log["Message"]("SEO audit passed!");
}

See Also

WebAuditsCheckpoint Object
Web Audits Checkpoints

Highlight search results