{"record":{"id":"b87c10f397db2468","repo":"grafana/k6","slug":"no-form-found-for-selector-s-in-response-s","errorCode":null,"errorMessage":"no form found for selector '%s' in response '%s'","messagePattern":"no form found for selector '(.+?)' in response '(.+?)'","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"js/modules/k6/http/response.go","lineNumber":175,"sourceCode":"\t\tfor _, k := range params.Keys() {\n\t\t\tswitch k {\n\t\t\tcase \"formSelector\":\n\t\t\t\tformSelector = params.Get(k).String()\n\t\t\tcase \"submitSelector\":\n\t\t\t\tsubmitSelector = params.Get(k).String()\n\t\t\tcase \"fields\":\n\t\t\t\tif rt.ExportTo(params.Get(k), &fields) != nil {\n\t\t\t\t\tfields = nil\n\t\t\t\t}\n\t\t\tcase \"params\":\n\t\t\t\trequestParams = params.Get(k)\n\t\t\t}\n\t\t}\n\t}\n\n\tform := res.HTML(formSelector)\n\tif form.Size() == 0 {\n\t\tcommon.Throw(rt, fmt.Errorf(\"no form found for selector '%s' in response '%s'\", formSelector, res.URL))\n\t}\n\n\tmethodAttr := form.Attr(\"method\")\n\tvar requestMethod string\n\tif methodAttr == sobek.Undefined() {\n\t\t// Use GET by default\n\t\trequestMethod = http.MethodGet\n\t} else {\n\t\trequestMethod = strings.ToUpper(methodAttr.String())\n\t}\n\n\tresponseURL, err := url.Parse(res.URL)\n\tif err != nil {\n\t\tcommon.Throw(rt, err)\n\t}\n\n\tactionAttr := form.Attr(\"action\")\n\tvar requestURL *url.URL","sourceCodeStart":157,"sourceCodeEnd":193,"githubUrl":"https://github.com/grafana/k6/blob/01ffac6f245854c1b8adc6a69857c76a15f90022/js/modules/k6/http/response.go#L157-L193","documentation":"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.","triggerScenarios":"Thrown at js/modules/k6/http/response.go:175 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"01ffac6f245854c1b8adc6a69857c76a15f90022","analyzedAt":"2026-08-18T03:05:52.393Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}