Parses the server response data and counts the appearance of the specified content with the provided string. If the verification condition is not met, an error is raised. The severity of this error can be specified. The appearance count of the specified content can be retrieved by an optional out-parameter. A subsequent low-level web function will not return a value until the request has finished. A cache hit is not performed unless the WEB_FLAG_DONT_FORCE_LOAD option is set. The verification is done even if this option is set and the verified request or a certain part of a page is a cache hit.
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 / Data / Data verification).
WebAPI.bdh
WebVerifyData( in sVerify : string, in nAppearance : number optional, in nOptions : number optional, in nDocNum : number optional, in nSeverity : number optional := SEVERITY_ERROR, out nResult : number optional ) ;
Parameter | Description |
---|---|
sVerify | String to compare with the parsed HTML content. |
nAppearance | Value to which the actual appearance of the specified content string is compared (see nOptions)(optional). If this parameter is omitted, the specified string must appear at least once to meet the verification rules. |
nOptions |
(optional)
|
nDocNum | Specifies the document to verify (optional). Specify WEB_DOC_ALL if you want to verify all documents. If this parameter is omitted, the first document gets verified. (see the above definition of FLAG_INCLUDE_EMBEDDED) |
nSeverity |
Optional: Severity of the error that is raised if the verification fails. Can be one of the following values:
|
nResult | If a variable is provided, it will receive the number of appearances of the specified content string (optional). |
dcltrans transaction TMain var nResult: number; begin WebVerifyData("<a href=sun.gif"); WebPageUrl("http://mycompany.com/"); WebVerifyData("<b>Begin</b>", 0, 0, 0, SEVERITY_WARNING); WebVerifyData("Shop</a>", 2, WEB_FLAG_EQUAL | WEB_FLAG_GREATER); WebUrl("http://mycompany.com/Shop/default.htm"); WebVerifyData("<Html>", 2, WEB_FLAG_CASE_SENSITIVE | WEB_FLAG_SMALLER, 2, SEVERITY_ERROR, nResult); WebPageUrl("http://mycompany.com/frame/framea.html"); Print(string(nResult)); end TMain;