{"record":{"id":"fcbf47a2fe256bca","repo":"grafana/k6","slug":"bringing-page-to-front-w","errorCode":null,"errorMessage":"bringing page to front: %w","messagePattern":"bringing page to front: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/browser/common/page.go","lineNumber":918,"sourceCode":"\t}\n\n\treturn nil\n}\n\nfunc (p *Page) viewportSize() Size {\n\treturn Size{\n\t\tWidth:  float64(p.emulatedSize.Viewport.Width),\n\t\tHeight: float64(p.emulatedSize.Viewport.Height),\n\t}\n}\n\n// BringToFront activates the browser tab for this page.\nfunc (p *Page) BringToFront() error {\n\tp.logger.Debugf(\"Page:BringToFront\", \"sid:%v\", p.sessionID())\n\n\taction := page.BringToFront()\n\tif err := action.Do(cdp.WithExecutor(p.ctx, p.session)); err != nil {\n\t\treturn fmt.Errorf(\"bringing page to front: %w\", err)\n\t}\n\n\treturn nil\n}\n\n// SetChecked sets the checked state of the element matching the provided selector.\nfunc (p *Page) SetChecked(selector string, checked bool, popts *FrameCheckOptions) error {\n\tp.logger.Debugf(\"Page:SetChecked\", \"sid:%v selector:%s checked:%t\", p.sessionID(), selector, checked)\n\n\treturn p.MainFrame().SetChecked(selector, checked, popts)\n}\n\n// Check checks an element matching the provided selector.\nfunc (p *Page) Check(selector string, popts *FrameCheckOptions) error {\n\tp.logger.Debugf(\"Page:Check\", \"sid:%v selector:%s\", p.sessionID(), selector)\n\n\treturn p.MainFrame().Check(selector, popts)\n}","sourceCodeStart":900,"sourceCodeEnd":936,"githubUrl":"https://github.com/grafana/k6/blob/3fcf5388d78cb382f0c0d42ec556a06bfd1b8dee/internal/js/modules/k6/browser/common/page.go#L900-L936","documentation":"Failure of the CDP page.bringToFront command, which activates this page's browser tab. Fires when the session rejects the command — closed page, headless-mode restriction, or canceled context — not because of tab state itself.","triggerScenarios":"Thrown at internal/js/modules/k6/browser/common/page.go:913 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure the page is open before calling BringToFront","Note bringToFront may be a no-op or unsupported in some headless configurations","Retry after the page finishes loading if the tab isn't interactive yet"],"exampleFix":null,"handlingStrategy":"try-catch","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"}