k6

A modern load testing tool, using Go and JavaScript

"like unit testing, for performance"

k6 is a modern load testing tool, building on Load Impact's years of experience. It provides a clean, approachable JavaScript scripting API, distributed and cloud execution, and orchestration via a REST API.

Get Started    Guides

Response.clickLink( [params] )

Create and make a request corresponding to a link, found in the HTML of response, being clicked. By default it will look for the first a tag with a href attribute in the HTML, but this can be overridden using the selector option.

This method takes an object argument where the following properties can be set:

Param
Type
Description

selector

string

A selector string passed to Selection.find(selector) to locate the link to click. By default this is "a[href]".

params

object

A Params (k6/http) object that will be forwarded to the link click request. Can be used to set headers, cookies etc.

Returns:

Type
Description

The link click response.

import http from "k6/http";

export default function() {
    // Request page with links
    let res = http.get("https://httpbin.org/links/10/0");
 
    // Now, click the 4th link on the page
    res = res.clickLink({ selector: 'a:nth-child(4)' })
}

Response.clickLink( [params] )


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.