grafana/k6 · error
no form found for selector '%s' in response '%s'
Error message
no form found for selector '%s' in response '%s'
What it means
SubmitForm parsed the response as HTML but the configured form selector (empty string means the default selector) matched zero elements. The guard fires on form.Size() == 0 — the page simply contains no <form> matching formSelector, so there is nothing to submit.
Source
Thrown at js/modules/k6/http/response.go:175
for _, k := range params.Keys() {
switch k {
case "formSelector":
formSelector = params.Get(k).String()
case "submitSelector":
submitSelector = params.Get(k).String()
case "fields":
if rt.ExportTo(params.Get(k), &fields) != nil {
fields = nil
}
case "params":
requestParams = params.Get(k)
}
}
}
form := res.HTML(formSelector)
if form.Size() == 0 {
common.Throw(rt, fmt.Errorf("no form found for selector '%s' in response '%s'", formSelector, res.URL))
}
methodAttr := form.Attr("method")
var requestMethod string
if methodAttr == sobek.Undefined() {
// Use GET by default
requestMethod = http.MethodGet
} else {
requestMethod = strings.ToUpper(methodAttr.String())
}
responseURL, err := url.Parse(res.URL)
if err != nil {
common.Throw(rt, err)
}
actionAttr := form.Attr("action")
var requestURL *url.URLView on GitHub (pinned to 01ffac6f24)
Solutions
- Verify the response actually contains a form element; print or inspect res.html() output
- Adjust the formSelector param to a selector that matches an existing form on the page
Defensive patterns
Strategy: type-guard
When it happens
Trigger: Thrown at js/modules/k6/http/response.go:175 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of grafana/k6@01ffac6f24 (2026-08-18).
Data as JSON: /api/errors/b87c10f397db2468.
Report an issue: GitHub.