{"record":{"id":"3697332caa1459c9","repo":"grafana/k6","slug":"getting-frame-content-expected-string-got-t","errorCode":null,"errorMessage":"getting frame content: expected string, got %T","messagePattern":"getting frame content: expected string, got %T","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/browser/common/frame.go","lineNumber":794,"sourceCode":"\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)\n\n\treturn nil\n}\n","sourceCodeStart":776,"sourceCodeEnd":812,"githubUrl":"https://github.com/grafana/k6/blob/3fcf5388d78cb382f0c0d42ec556a06bfd1b8dee/internal/js/modules/k6/browser/common/frame.go#L776-L812","documentation":"Returned by Frame.Content as a type guard: the serialization evaluation succeeded but its return value is not a string (e.g. undefined/null slipped through, or a handle). The actual Go type is reported. Defensive check; the page script contract (returning a string) was violated internally.","triggerScenarios":"Thrown at internal/js/modules/k6/browser/common/frame.go:786 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Retry the call after the page settles","Report as a k6 browser module bug if persistent"],"exampleFix":null,"handlingStrategy":"type-guard","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"}