{"record":{"id":"0baa1b42018dbe32","repo":"grafana/k6","slug":"getting-frame-content-w","errorCode":null,"errorMessage":"getting frame content: %w","messagePattern":"getting frame content: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/browser/common/frame.go","lineNumber":790,"sourceCode":"\n// Content returns the HTML content of the frame.\nfunc (f *Frame) Content() (string, error) {\n\tf.log.Debugf(\"Frame:Content\", \"fid:%s furl:%q\", f.ID(), f.URL())\n\n\tjs := `() => {\n\t\tlet content = '';\n\t\tif (document.doctype) {\n\t\t\tcontent = new XMLSerializer().serializeToString(document.doctype);\n\t\t}\n\t\tif (document.documentElement) {\n\t\t\tcontent += document.documentElement.outerHTML;\n\t\t}\n\t\treturn content;\n\t}`\n\n\tv, err := f.Evaluate(js)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"getting frame content: %w\", err)\n\t}\n\ts, ok := v.(string)\n\tif !ok {\n\t\treturn \"\", fmt.Errorf(\"getting frame content: expected string, got %T\", v)\n\t}\n\n\treturn s, nil\n}\n\n// Dblclick double clicks an element matching provided selector.\nfunc (f *Frame) Dblclick(selector string, popts *FrameDblclickOptions) error {\n\tf.log.Debugf(\"Frame:DblClick\", \"fid:%s furl:%q sel:%q\", f.ID(), f.URL(), selector)\n\n\tif err := f.dblclick(selector, popts); err != nil {\n\t\treturn fmt.Errorf(\"double clicking on %q: %w\", selector, err)\n\t}\n\n\tapplySlowMo(f.ctx)","sourceCodeStart":772,"sourceCodeEnd":808,"githubUrl":"https://github.com/grafana/k6/blob/3fcf5388d78cb382f0c0d42ec556a06bfd1b8dee/internal/js/modules/k6/browser/common/frame.go#L772-L808","documentation":"Returned by Frame.Content when evaluating the serialization JS (doctype + documentElement.outerHTML) in the frame fails. The wrap marks the operation; the wrapped evaluation error (context destroyed by navigation, JS exception, CDP error) holds the cause.","triggerScenarios":"Thrown at internal/js/modules/k6/browser/common/frame.go:782 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Call Content after the frame finishes loading (waitForLoadState)","Retry after navigation settles","Inspect the wrapped evaluation error"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"3fcf5388d78cb382f0c0d42ec556a06bfd1b8dee","analyzedAt":"2026-08-18T03:05:52.393Z","contentChangedAt":"2026-08-18T03:05:52.393Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}