web.globalVerification

Searches for a text string in all subsequent requests.

Syntax

            
            web.globalVerification( {object} );

JavaScript Object

{  
   text:"{value: "<search string>"[, flag: "<text_flag>"] },
   textPfx:{value: "<search string>"[, flag: "<text_flag>"] },
   textSfx:"{value: "<search string>"[, flag: "<text_flag>"] },
   search:"<string>",
   fail:"<string>",
   id:"<string>"
}
Property Name
Description
textThe text string to search for. This property must be a non–empty character string. You can further customize your search by using Text Flags.
If you pass text, do not pass textPfx or textPfx.
textPfxThe prefix of the text string for which you are searching. You can further customize your search by using Text Flags.
Required if you do not pass text.
textSfxThe suffix of the text string for which you are searching. . You can further customize your search by using Text Flags.
Required if you do not pass text.
searchWhere to search for the text. The available values are Headers, body, NORESOURCE, or All. The default is NORESOURCE. This attribute is optional.
failThe handling option when the string is not found The available values are Found (default) and NotFound. Found indicates that a failure occurs when the text is found (e.g., "Error"). NotFound indicates that a failure occurs when the text is not found.
idA identifying string used to denote this particular call to web.globalVerification. For example, it is used in the log file and in calls to web.globalVerificationPause.

Return Values

Not applicable

Parameterization

The following arguments can be parameterized using standard parameterization: text, textPfx, and textSfx

General Information

The web.globalVerification function registers a request to search for the specified text string in web pages returned by all subsequent action functions. The script fails if the fail condition occurs in any subsequent action function. This is in contrast to the web.regFind function which only registers a request for the next action function.

To suspend the check, use web.globalVerificationPause. If more than one check is in force due to multiple calls to web.globalVerification, call web.globalVerificationPause for each check you want to suspend.

The web.globalVerification function is useful in detecting application level errors that are not represented by HTTP status codes. To locate errors that are represented by HTTP status codes, use web.getIntProperty.

You can use one of the following flags to modify text, or textPfx and textSfx:

  • IC to ignore the case.
  • BIN to specify binary data.

For example:

{value: "Mansfield park", flag: "IC"} or {value: "\\x24\\x81", flag: "BIN"}

You can search the body, headers, html code, or the entire contents of a page. The search options are:

  • all: the entire HTML page

  • headers: only the its headers, not the body

  • body: the body, excluding all headers, but including all resources

  • NORESOURCE: only the html body, excluding all headers and resources (default)

If you do not know the exact text to search for, or if the text is not consistent, you can qualify it by its beginning and end, using the textPfx and textSfx properties. The prefix and suffix are actually the boundaries of the text—textSfx is the right boundary and textPfx is the left boundary. When using these properties, you must specify a non–empty value for both attributes. Do not pass the text property if you pass textPfx and textSfx.

When "fail = Found" is specified (or no fail condition is specified) with textPfx and textSfx and the left and right boundaries are found more than once, each match is issued as an error up to the maximum number of errors configured in the Runtime Settings > Preferences > Advanced Options. Subsequent matches are logged as informational messages.

Example

function Action(){
   web.globalVerification({text:"Acme Company", 
    fail: "NotFound",
    id: "FindAcme"}); 

   web.customRequest(
     {
        name : 'kalimanjaro', 
        url : 'http://kalimanjaro/', 
        method : 'GET', 
        resource : 0, 
        recContentType : 'text/html', 
        referer : '', 
        snapshot : 't17.inf', 
        mode : 'HTTP'
     }
   );

return 0;
}