{"record":{"id":"8f2ea7f06005917e","repo":"grafana/k6","slug":"evaluating-handle-for-page-w","errorCode":null,"errorMessage":"evaluating handle for page: %w","messagePattern":"evaluating handle for page: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/browser/common/page.go","lineNumber":1131,"sourceCode":"\tapplySlowMo(p.ctx)\n\n\treturn nil\n}\n\n// Evaluate runs JS code within the execution context of the main frame of the page.\nfunc (p *Page) Evaluate(pageFunc string, args ...any) (any, error) {\n\tp.logger.Debugf(\"Page:Evaluate\", \"sid:%v\", p.sessionID())\n\n\treturn p.MainFrame().Evaluate(pageFunc, args...)\n}\n\n// EvaluateHandle runs JS code within the execution context of the main frame of the page.\nfunc (p *Page) EvaluateHandle(pageFunc string, args ...any) (JSHandleAPI, error) {\n\tp.logger.Debugf(\"Page:EvaluateHandle\", \"sid:%v\", p.sessionID())\n\n\th, err := p.MainFrame().EvaluateHandle(pageFunc, args...)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"evaluating handle for page: %w\", err)\n\t}\n\treturn h, nil\n}\n\n// Fill fills an input element with the provided value.\nfunc (p *Page) Fill(selector string, value string, popts *FrameFillOptions) error {\n\tp.logger.Debugf(\"Page:Fill\", \"sid:%v selector:%s\", p.sessionID(), selector)\n\n\treturn p.MainFrame().Fill(selector, value, popts)\n}\n\n// Focus focuses an element matching the provided selector.\nfunc (p *Page) Focus(selector string, popts *FrameBaseOptions) error {\n\tp.logger.Debugf(\"Page:Focus\", \"sid:%v selector:%s\", p.sessionID(), selector)\n\n\treturn p.MainFrame().Focus(selector, popts)\n}\n","sourceCodeStart":1113,"sourceCodeEnd":1149,"githubUrl":"https://github.com/grafana/k6/blob/3fcf5388d78cb382f0c0d42ec556a06bfd1b8dee/internal/js/modules/k6/browser/common/page.go#L1113-L1149","documentation":"Wrapped failure from Frame.EvaluateHandle while executing the given page function in the main frame's context and wrapping the result in a JSHandle. Fires when the script throws, is not valid JS, the execution context is destroyed by navigation, or the CDP evaluate call fails.","triggerScenarios":"Thrown at internal/js/modules/k6/browser/common/page.go:1126 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the page function is syntactically valid and runs without exceptions","Await navigation before evaluating, or retry on context-destroyed errors","Use Evaluate for plain values; EvaluateHandle only when a handle is needed"],"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"}