Share this page

# web_link

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

## C Language

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

Action Functions

## Java Language

    int object.link( String stepName, String textName, 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 link in the tree view. Also used as the transaction name for automatic transactions.
List of Attributes | The following attributes are supported: Text: The exact text that appears in the hypertext link. 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 ResourceByteLimit, and Ordinal. Recorded Attributes: Text: The exact text that appears in the hypertext link. Ordinal
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_link function is an action function that emulates a mouse click on the link that is defined by the attributes. (Each Web Action Function in a script causes the browser to display a new web page or frame. All Web Action functions can be recorded by VuGen.) The web_link function can be executed only in the context of a previous operation.

web_link 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 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 if certain conditions are met. 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_link is supported for web scripts.

## C Example

In the following example, the script loads a URL and then clicks alink:

    web_url("test.html",
        "URL=http://localhost/test.html",
        "Resource=0",
        "RecContentType=text/html",
        "Referer=",
        "Mode=HTML",
        LAST );

    web_link("Test1",
        "Text=Test1",
        LAST );

## Java Example

In the following example, the script loads a URL and then clicks alink:

    web.url("test.html",
        "URL=http://localhost/test.html",
        new String[]{
            "Resource=0",
            "RecContentType=text/html",
            "Referer=",
            "Mode=HTML",
            web.LAST
        });

    web.link("Test1",
        "Text=Test1",
        new String[]{web.LAST});

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