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 verification result can be retrieved by an optional out-parameter. 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 frames that are checked for the title can be specified with the nDocNum 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).
This verification feature can be enabled/disabled globally (Profile Settings / Web / Verification / HTML / Title verification).
WebAPI.bdh
WebVerifyHtmlTitle( in sVerify : string, in nOptions : number optional, in nDocNum : number optional, in nSeverity : number optional := SEVERITY_ERROR, out bSuccess : boolean optional );
Parameter | Description |
---|---|
sVerify | String to compare with the parsed title. |
nOptions |
(optional)
|
nDocNum | Specifies the document to check the title for (optional). The default (1) specifies the top document (e.g. a frameset). |
nSeverity |
Optional: Severity of the error that is raised if the verification fails. Can be one of the following values:
|
bSuccess | If a variable is provided, it will receive the result of the verification (optional). |
dcltrans
transaction TMain
var
bResult: boolean;
begin
WebVerifyHtmlTitle("Silk Performer Test Site");
WebPageUrl("http://mycompany.com/");
WebVerifyHtmlTitle("ShopIt - Greeting",
WEB_FLAG_CASE_SENSITIVE, 1, SEVERITY_WARNING, bResult);
WebUrl("http://mycompany.com/Shop/default.htm");
if not bResult then
print("Verification failed");
end
WebVerifyHtmlTitle("FrameA", 0, 1); // base frameset
verification
WebVerifyHtmlTitle("Buy It", 0, 3); // second frame
WebPageUrl("http://mycompany.com/frame/framea.html");
end TMain;