WebParseHtmlTitle Function

Action

Parses the <TITLE> tag of the HTML response and stores the content it in the provided string. A subsequent low-level web function will not return a value until the request has finished. If a page consists of more than one HTML document, the sub frame that gets parsed for the HTML title can be specified with the nDoc parameter.

When verifying/parsing an HTML page that consists of multiple frames (HTML documents), you can specify which frame document to verify/parse by specifying the nDocNum parameter. By default (1) the top document (e.g. a frameset) is scanned. This applies to HTML pages that are retrieved through a page-level command like WebPageUrl or WebPageLink.

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 (Exception: WebParseDataBound and WebVerifyDataBound using the flag WEB_FLAG_SYNCHRON).

Include file

WebAPI.bdh

Syntax

WebParseHtmlTitle( out sResult       : string,
                   in  nMaxResultLen : number optional,
                   in  nDocNum       : number optional );

Return value

  • none

Parameter Description
sResult String variable that receives the string between the specified boundary strings.
nMaxResultLen Maximum length of the string to return (optional). If this parameter is omitted or set to STRING_COMPLETE all available data is stored in sResult.
nDocNum Specifies the document where to parse the HTML title (optional). The default (1) specifies the top document (e.g. a frameset).

Example

dcltrans
  transaction TMain
  var
    sResult  : string;
    sResult1 : string;
  begin
    WebParseHtmlTitle(sResult, STRING_COMPLETE);
    WebPageUrl("http://mycompany.com/");
    WebParseHtmlTitle(sResult, STRING_COMPLETE);
    WebUrl("http://mycompany.com/Shop/default.htm");
    WebVerifyHtmlTitle(sResult);
    WebVerifyHtmlTitle(sResult1, 200, 2); // second frame
    WebPageUrl("http://mycompany.com/frame/framea.html");
  end TMain;