Share this page

# web_image

Emulates a mouse click on the image that is defined by the attributes.

## C Language

    int web_image( constchar *StepName, <List of Attributes>, [EXTRARES, <List of Resource Attributes>,] LAST );

Action Functions

## Java Language

    int object.image( String StepName, String [] argumentList );

Action 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.
StepName | The name of the image in the tree view. Also used as the transaction name for automatic transactions.
List of Attributes – both client–side and server–side image maps. | ALT: The ALT attribute of the IMG element that defines the image. The ALT attribute appears in a bubble when pointing to the associated image, and as text before the image is loaded. SRC: The SRC attribute of the IMG element that defines the image. Alternatively, the file name of the image. For example, button.gif. You can also specify SRC/SFX to specify a suffix for the image's path. All strings with that suffix will be considered a match. Frame: The name of the frame in which you recorded the operation. The name of the frame is the value of the name attribute of the FRAME element. TargetFrame, and Ordinal ALT is recorded if it exists, otherwise SRC is recorded. Ordinal is used for resolving ambiguity in both cases. ResourceByteLimit: Click ResourceByteLimit for more information.
List of Attributes – client–side image maps only. | The following attributes apply to client–side image maps only: AreaAlt: the ALT attribute of the area to click. AreaOrdinal: the serial number of the area to click. MapName: the name of the map related to the image.
List of Attributes – server–side image maps only. | The following attributes apply to server–side image maps only (although the coordinates of the click are not "attributes", the attribute format is used for them): Xcoord: The X coordinate of the click on the image. Ycoord: The Y coordinate of the click on the image.
EXTRARES | A demarcation parameter indicating that the next parameter will be a list of resource attributes.
List of Resource Attributes | List of Resource Attributes
LAST | A marker that indicates the end of the argument 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: List of Attributes

## General Information

The web_image action function emulates a mouse click on the image that is defined by the attributes. This function may be executed only in the context of a previous operation.

web_image is recorded only when VuGen is in HTML–based recording mode (see VuGen's Recording Options).

The web_image function supports both client–side and server–side image maps. See the List of Attributes above for those attributes that are specific to client–side and server–side image maps.

Examples of non–HTML–generated resources are .gif and .jpg images. The List of Resource Attributes are only inserted when the recording option for these resources is set at "Record within the current script step". This is the default setting. Refer to the Virtual User Generator Help Center.

The HTTP header can be modified to pass additional information about the request to the server. Using HTTP headers you can, for example, allow other content types in the response such as compressed files, or you can request a web page only on certain conditions. To modify the HTTP header in the request see web_add_header. To modify all subsequent requests, see web_add_auto_header.

The function web_image is supported for all web scripts.

## C Examples

### Example 1

The following example emulates the user clicking the Home icon to return to the Home page:

Copy code

    web_url("my_home", "URL=http://my_home/", LAST );
    web_link("Employees", "Text=Employees", LAST );
    web_image("Home.gif", "SRC=../gifs/Buttons/Home.gif", LAST );
    web_link("Library", "Text=Library", LAST );
    web_image("Home.gif", "SRC=../../gifs/buttons/Home.gif", LAST );

### Example 2: Client–side image map

The following example emulates the user clicking on a client–side image map.

Copy code

    web_image("dpt_house.gif",
        "Src=../gifs/dpt_house.gif",
        "MapName=dpt_house",
        "AreaOrdinal=4",
        LAST );

### Example 3: Server–side image map

The following example emulates the user clicking on a server–side image map.

Copy code

    web_image("The Web Developer's Virtual Library",
        "Alt=The Web Developer's Virtual Library",
        "Ordinal=1",
        "XCoord=91",
        "YCoord=17",
        LAST );

### Example 4: Using a suffix as a match criteria

The following example specifies the dpt_house.gif as a suffix. Possible matches are ../gifs/dpt_house.gif, /gifs/dpt_house.gif, gifs/dpt_house.gif, and /dpt_house.gif.

Copy code

    web_image("dpt_house.gif",
         "Src/sfx=dpt_house.gif",
         LAST );

## Java Examples

### Example 1

The following example emulates the user clicking the Home icon to return to the Home page:

Copy code

    web.image("Home.gif",
        new String[] {"SRC=../../gifs/buttons/Home.gif", "LAST"});

### Example 2: Client–side image map

The following example emulates the user clicking on a client–side image map.

Copy code

    web.image("dpt_house.gif",
        new String[]{
            "Src=../gifs/dpt_house.gif",
            "MapName=dpt_house",
            "AreaOrdinal=4",
            "LAST"});

### Example 3: Server–side image map

The following example emulates the user clicking on a server–side image map.

Copy code

    web.image("The Web Developer's Virtual Library",
        new String[]{
            "Alt=The Web Developer's Virtual Library",
            "Ordinal=1",
            "XCoord=91",
            "YCoord=17",
            "LAST"});

### Example 4: Using a suffix as a match criteria

The following example specifies the dpt_house.gif as a suffix. Possible matches are ../gifs/dpt_house.gif, /gifs/dpt_house.gif, gifs/dpt_house.gif, and /dpt_house.gif.

Copy code

    web.image("dpt_house.gif",
        new String[]{
            "Src/sfx=dpt_house.gif",
            "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: