JavaScript Functions > Alphabetical Listing of Web Functions > web.image

web.image

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

Syntax

web.image( {object} );

JavaScript Object

{  
   stepName:"<string>",
   alt:"<string>",
   src:"<string>",
   frame:"<string>",
   targetFrame:"<string>",
   ordinal:"<string>",
   resourceByteLimit:"<string>",
   areaAlt:"<string>",
   areaOrdinal:"<string>",
   mapName:"<string>",
   xcoord: <number>,
   ycoord: <number>,
   snapshot:"<string>",
   "extraRes":[  
      {  
         url:"<string>",
         referer:"<string>"
      }
   ]
} 
Property Name
Description
stepName
The name of the image in the tree view. Also used as the transaction name for automatic transactions.
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.
alt is recorded if it exists, otherwise src is recorded.
ordinal Used to resolve ambiguity if more than one image matches the image attributes.
resourceByteLimit A limit based on the accumulated size of the bodies of the resources on this Web page that have already been downloaded. Applies only to Sockets replay.
src The src attribute of the IMG element that defines the image. Alternatively, the file name of the image. For example, button.gif.
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 The name or the target frame or one of the standard HTML specifiers. For example, "TargetFrame": "_blank".
areaAlt
 
The alt attribute of the area to click. Client–side image maps only.
areaOrdinal The 1-based serial number of the area to click. Client–side image maps only.
mapname The name of the map related to the image. Client–side image maps only.
xcoord
 
The X coordinate of the click on the image. Server–side image maps only.
ycoord The Y coordinate of the click on the image. Server–side image maps only.
snapshot The name of the snapshot file is generated automatically. Do not change it. When manually coding a Vuser script function call, do not enter it. When copying an existing function call, delete the Snapshot argument.
extraRes
Resources to download with the Web page.

Return Values

Not applicable

Parameterization

The following argument(s) can be parameterized using standard parameterization: All image attributes.

General Information

The web.image action function emulates a mouse click an image. This function can be executed only in the context of a previous operation.

ALT is recorded if it exists, otherwise SRC is recorded. Ordinal is used for resolving ambiguity in both cases.

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

Examples of non–HTML–generated resources are .gif and .jpg images. The attributes of the image are only inserted when the recording option for these resources is "Record within the current script step". This is the default setting. Refer to the Virtual User Generator User Guide.

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.addHeader. To modify all subsequent requests, see web.addAutoHeader.

Example

web.image( {stepName: "Home.gif", src:"../../gifs/buttons/Home.gif"} );

For more options, see the C language example, Example: web_image.