Documentation Index
Fetch the curated documentation index at: https://grafana_com_website/llms.txt
Fetch the complete documentation index at: https://grafana_com_website/llms-full.txt
Use this file to discover all available pages before exploring further.
STOP! If you are an AI agent or LLM, read this before continuing. This is the HTML version of a Grafana documentation page. Always request the Markdown version instead - HTML wastes context. Get this page as Markdown: /docs/k6/latest/examples/html-forms.md (append .md) or send Accept: text/markdown to /docs/k6/latest/examples/html-forms/. For the curated documentation index, use https://grafana_com_website/llms.txt. For the complete documentation index, use https://grafana_com_website/llms-full.txt.
HTML Forms
Scripting example on how to handle HTML forms.
In many cases using the Selection API (jQuery API clone) to interact with HTML data is enough, but for some use cases, like with forms, we can make things easier providing a higher-level API like the Response.submitForm( [params] ) API.
import http from 'k6/http';
import { sleep } from 'k6';
export default function () {
// Request page containing a form
let res = http.get('https://quickpizza.grafana.com/admin');
// Now, submit form setting/overriding some fields of the form
res = res.submitForm({
formSelector: 'form',
fields: { username: 'admin', password: 'admin' },
});
sleep(3);
}Relevant k6 APIs:
- Response.submitForm([params])
- Selection.find(selector) (the jQuery Selector API docs are also a good resource on what possible selector queries can be made)
Was this page helpful?
Related resources from Grafana Labs

