ClickRegion Method

Class

HtmlImage.

Action

Clicks on the named region.

Availability

This functionality is supported only if you are using the Classic Agent.

Syntax

image.ClickRegion (sRegion [, iButton])
Variable Description
sRegion The region. STRING.
iButton Optional: The mouse button to press: Windows: 1 for left (default), 2 for right, and 3 for center. INTEGER.

Notes

An image map is an image that contains regions, which are areas that are links that can be clicked. You can get a list of regions that an image map contains with the GetRegionList function.

You can use ClickRegion only with client-side image maps (see the description of the GetRegionList function). To click a server-side image map, use the Click method and pass in the coordinates relative to the image.

When recording against an image that has mapped regions, Silk Test Classic records ClickRegion("full URL").

You can use wildcards in region names: * is a placeholder for zero or more characters; ? is a placeholder for one character.

You can specify the region in two ways:

  • Using the base URL, which is the form that GetRegionList returns by default.
  • Using the full URL, which is the form that GetRegionList returns if you specify the optional argument. Begin the URL specification with $. If you use the full URL, it is a good idea to use wildcards, however, you can only use wildcards after $http and $file.

With the DOM extension, each region is identified as an HtmlLink.

ClickRegion() does not click an image map when the browser is too small to display the entire image map. No exception is raised.

Example

This example uses an image that consists of six clickable regions, each of which appears to be a button. The image is declared as ButtonBar.

 ProtoPage.ButtonBar.ClickRegion ("icons#multi")
// Result:
// Clicks the image map on the specified region.