Share this page

# web_set_option

Sets a web option.

## C Language

    int web_set_option( const char *OptionID, const char *OptionValue, LAST );

Replay Functions

## Java Language

    int object.set_option( String OptionID, String OptionValue, String LAST );

Replay Functions | Java Syntax

Argument | Description
--- | ---
object | An expression evaluating to an object of type WebApi. Usually web for Java. See also Function and Constant Prefixes.
OptionID | The option whose value you want to set (case insensitive).
OptionValue | The value of the specified option (case insensitive),
LAST | A marker that indicates the end of the option list.

## Return Values

This function returns LR_PASS (0) on success, and LR_FAIL (1) on failure.

## Parameterization

The following argument(s) can be parameterized using standard parameterization: OptionID, OptionValue

## General Information

The web_set_option function sets a web option. It is service function that affects all functions following it, until a new value is specified. When the vuser_init section finishes running, the current options values are saved. The values are restored to the saved values before the start of each iteration.

The following options are supported:

DecodeContent: Enables or disables decoding of server reply content when a "Content–Encoding" header is sent by the server. Currently it affects decompression only. The available values are "`Yes`" and "`No`".

DecodeContentForResources: Enables or disables the decoding of server resources. When disabled, this option excludes the resources from the decoding, thus reducing CPU utilization. The default value is "`Yes`" - enabled.

DownloadNonHtmlResources: Set to "Yes" to start or resume downloading non–HTML resources (for example, images) in a web page during replay. Set to "No" to stop. This option gives you the opportunity to override the Browser Emulation option in the Vuser's Run–Time Settings, Download non–HTML Resources. This option can help when debugging. At certain points in the code you may want to stop downloading resources to save time.

LRW_OPT_DISPLAY_IMAGE_BODY: Set to "Yes" to display the response and request body for images. Set to "No" to restore the default behavior of not displaying the bodies.

IgnoreCookieExpiresAttribute: Set to "Yes" to ignore the "expires" attribute of all cookies. Set to "No" to restore the default behavior of not processing expired cookies.

MaxRedirectionDepth: The maximum redirection depth. This option has the same effect as specifying MaxRedirectionDepth in the default.cfg file of a script. The value of this option must be a character string representing a decimal number.

LRW_OPT_NON_GUI_FRAMES_SCHEME_JAVASCRIPT: In low level (HTML and URL) scripts, frames defined "<FRAME SRC=JAVASCRIPT..> can be ignored when calculating the relative frame ID by setting this option to "No". The default is "Yes". This option does not apply to GUI level scripts.

LRW_OPT_HTML_CHAR_REF_BACKWARD_COMPATIBILITY: This option is for expert users. There are two types of web functions: low–level (HTML and URL) and GUI level. Unicode and certain character combinations are treated differently at the two levels. By setting this option to `LRW_OPT_VALUE_NO`, you can force GUI level character handling. Set the option back to `LRW_OPT_VALUE_YES` after the calls for which you wish to force GUI level handling. The default is `LRW_OPT_VALUE_YES.`

This function is supported for all web scripts.

## C Example

In the following example, the web_set_option function sets the decoding and redirection options:

Copy code

    // Disables decoding
    web_set_option("DecodeContent", "No", LAST );

    // Enables decoding
    web_set_option("DecodeContent", "Yes", LAST );

    // Disables redirection. If redirection is required in following action functions, a warning is issued.
    web_set_option("MaxRedirectionDepth", "0", LAST );

    // Sets the maximum redirection depth to 10.
    web_set_option("MaxRedirectionDepth", "10", LAST );

## Java Example

In the following example, the set_option function sets the decoding and redirection options:

Copy code

    // Disables decoding

    web.set_option("DecodeContent", "No",
        new String[]{"LAST"});

    // Enables decoding

    web.set_option("DecodeContent", "Yes",
        new String[]{"LAST"});

    /* Disables redirection. If redirection is required in following action functions, a warning is issued. */

    web.set_option("MaxRedirectionDepth", "0",
       new String[]{"LAST"});

    // Sets the maximum redirection depth to 10.

    web.set_option("MaxRedirectionDepth", "10",
        new String[]{"LAST"});

Tips to improve your search results... VuGen Function Reference Version 26.1-26.3 Function Reference 26.1-26.3 All View Local Help Center View Online Help Center Version: