WebVerifyTitle Function

Action

Parses the <TITLE> tag of the HTML response and compares its content with the provided string. If it does not match, an error is raised; the severity of this error can be specified. The parsed title can be retrieved by an optional out-parameter. If this parameter is provided, a subsequent low-level web function will not return until the request has finished. If it is omitted, a subsequent low-level web function will not wait for the completion of the request. If a page consists of more than one HTML document, additional calls of the WebVerifyTitle function check the title of the sub frames.

It is important to know that all parsing and verification functions must be specified before the Web API call for which the response data should be parsed/verified. You can specify multiple parse/verification functions before a Web API call. The order of the parse/verification functions is not relevant. An exception to this rule is using WebParseDataBound and WebVerifyDataBound with the flag WEB_FLAG_SYNCHRON).

This verification feature can be disabled globally using the response title verification option in the verification category of the Web profile settings.

注: This function is obsolete. It can still be used, though it is recommended that you use the WebVerifyHtmlTitle function instead.

Include file

WebAPI.bdh

Syntax

WebVerifyTitle( in  sTitle        : string optional,
                in  nSeverity     : number optional := SEVERITY_ERROR, 
                out sResult       : string optional,
                in  nMaxResultLen : number optional,
                in  nModeCompare  : number optional ): boolean;

Return value

  • true if the parsing modifier could be created successfully

  • false otherwise

Parameter Description
sTitle String to compare with the parsed title (optional). If this parameter is omitted, no error is raised (useful for pages with sub frames only).
nSeverity Optional: Severity of the error that is raised if the verification fails. Can be one of the following values:
  • SEVERITY_SUCCESS: Success; no error (numerical value: 0)
  • SEVERITY_INFORMATIONAL: Informational; no error (numerical value: 1)
  • SEVERITY_WARNING: Warning; no error (numerical value: 2)
  • SEVERITY_ERROR: (Default) Error; simulation continues (numerical value: 3)
  • SEVERITY_TRANS_EXIT: Error; the active transaction is aborted (numerical value: 4)
  • SEVERITY_PROCESS_EXIT: Error; the simulation is aborted (numerical value: 5)
sResult If a variable is provided, it will receive the parsed title (optional).
nMaxResultLen Maximum length of the string to return. This value must be less than or equal to the size of the string variable sResult (optional). If this parameter is omitted, the string length is unlimited.
nModeCompare If this parameter is set to WEB_VER_FLAG_CASE_SENSITIVE, the compare operation is case sensitive (optional). If this parameter is omitted, the compare operation is not case sensitive.

Example

dcltrans
  transaction TMain
  var
    sResult: string;
  begin
    WebVerifyTitle("Silk Performer Test Site");
    WebPageUrl("http://mycompany.com/");
    WebVerifyTitle("ShopIt - Greeting", SEVERITY_WARNING,
                   sResult, STRING_COMPLETE, WEB_VER_FLAG_CASE_SENSITIVE);
    WebUrl("http://mycompany.com/Shop/default.htm");
    Print(sResult);
    WebVerifyTitle("FrameA"); // base frameset
    WebVerifyTitle(); // first frame - perform no verification
    WebVerifyTitle("Buy It"); // second frame
    WebPageUrl("http://mycompany.com/frame/framea.html");
  end TMain;