grafana/k6 · error
getting frame content
Error message
getting frame content: %w
What it means
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.
Solutions
- Call Content after the frame finishes loading (waitForLoadState)
- Retry after navigation settles
- Inspect the wrapped evaluation error
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at internal/js/modules/k6/browser/common/frame.go:782 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of grafana/k6@3fcf5388d7 (2026-08-18).
Data as JSON: /api/errors/0baa1b42018dbe32.
Report an issue: GitHub.
Appendix: source
Thrown at internal/js/modules/k6/browser/common/frame.go:790
// Content returns the HTML content of the frame.
func (f *Frame) Content() (string, error) {
f.log.Debugf("Frame:Content", "fid:%s furl:%q", f.ID(), f.URL())
js := `() => {
let content = '';
if (document.doctype) {
content = new XMLSerializer().serializeToString(document.doctype);
}
if (document.documentElement) {
content += document.documentElement.outerHTML;
}
return content;
}`
v, err := f.Evaluate(js)
if err != nil {
return "", fmt.Errorf("getting frame content: %w", err)
}
s, ok := v.(string)
if !ok {
return "", fmt.Errorf("getting frame content: expected string, got %T", v)
}
return s, nil
}
// Dblclick double clicks an element matching provided selector.
func (f *Frame) Dblclick(selector string, popts *FrameDblclickOptions) error {
f.log.Debugf("Frame:DblClick", "fid:%s furl:%q sel:%q", f.ID(), f.URL(), selector)
if err := f.dblclick(selector, popts); err != nil {
return fmt.Errorf("double clicking on %q: %w", selector, err)
}
applySlowMo(f.ctx)View on GitHub (pinned to 3fcf5388d7)