Documentation for automated readers
A curated documentation index is available at: https://grafana.com/llms.txt
A complete documentation index is available at: https://grafana.com/llms-full.txt
These indexes can help with page discovery before fetching individual documents.
This page is also available in Markdown, which may be easier for automated readers and AI tools to parse than HTML. The Markdown version is available at https://grafana.com/docs/k6/next/javascript-api/k6-http/response/response-clicklink.md, or by sending Accept: text/markdown to https://grafana.com/docs/k6/next/javascript-api/k6-http/response/response-clicklink/. For broader documentation discovery, the curated index is available at https://grafana.com/llms.txt and the complete index is available at https://grafana.com/llms-full.txt.
This is documentation for the next version of Grafana k6 documentation. For the latest stable release, go to the latest version.
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 object that will be forwarded to the link click request. Can be used to set headers, cookies etc. |
Returns
| Type | Description |
|---|---|
| Response | The link click response |
Example
import http from 'k6/http';
export default function () {
// Request page with links
let res = http.get('https://quickpizza.grafana.com/admin');
// Now, click the 4th link on the page
res = res.clickLink({ selector: 'a:nth-child(1)' });
}Was this page helpful?
Related resources from Grafana Labs

