grafana/k6 · error
enabling page domain
Error message
enabling page domain: %w
What it means
During initFrameTree, the Page.enable CDP call failed, so the Page domain (needed for navigation, frame tree, dialogs) could not be enabled for this session. The wrapped error is Chromium's; frame session setup aborts.
Solutions
- Inspect the wrapped CDP error for Chromium's reason
- Check browser health and logs (crashes, too many targets)
- Update k6/Chromium and retry
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at internal/js/modules/k6/browser/common/frame_session.go:424 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/15042a86d78a4f9f.
Report an issue: GitHub.
Appendix: source
Thrown at internal/js/modules/k6/browser/common/frame_session.go:477
// it seems to pause the exec of any other action on
// the page. I believe this is an issue in Chromium.
action := cdppage.HandleJavaScriptDialog(false)
if event.Type == cdppage.DialogTypeBeforeunload {
action = cdppage.HandleJavaScriptDialog(true)
}
if err := action.Do(cdp.WithExecutor(fs.ctx, fs.session)); err != nil {
fs.logger.Errorf("FrameSession:onEventJavascriptDialogOpening", "failed to dismiss dialog box: %v", err)
}
}
func (fs *FrameSession) initFrameTree() error {
fs.logger.Debugf("NewFrameSession:initFrameTree",
"sid:%v tid:%v", fs.session.ID(), fs.targetID)
action := cdppage.Enable()
if err := action.Do(cdp.WithExecutor(fs.ctx, fs.session)); err != nil {
return fmt.Errorf("enabling page domain: %w", err)
}
var frameTree *cdppage.FrameTree
var err error
// Recursively enumerate all existing frames in page to create initial in-memory structures
// used for access and manipulation from JS.
action2 := cdppage.GetFrameTree()
if frameTree, err = action2.Do(cdp.WithExecutor(fs.ctx, fs.session)); err != nil {
return fmt.Errorf("getting page frame tree: %w", err)
} else if frameTree == nil {
// This can happen with very short scripts when we might not have enough
// time to initialize properly.
return fmt.Errorf("got a nil page frame tree")
}
// Any new frame may have a child frame, not just mainframes.
fs.handleFrameTree(frameTree, fs.isMainFrame())View on GitHub (pinned to 3fcf5388d7)