{"record":{"id":"ad0b41a2bb231f08","repo":"grafana/k6","slug":"finding-position-in-frame-w","errorCode":null,"errorMessage":"finding position in frame: %w","messagePattern":"finding position in frame: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/browser/common/frame.go","lineNumber":393,"sourceCode":"\t//       website never stops performing network requests.\n}\n\nfunc (f *Frame) position() (*Position, error) {\n\tframe, ok := f.manager.getFrameByID(cdp.FrameID(f.page.targetID))\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"could not find frame with id %s\", f.page.targetID)\n\t}\n\tif frame == f.page.frameManager.MainFrame() {\n\t\treturn &Position{X: 0, Y: 0}, nil\n\t}\n\telement, err := frame.FrameElement()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbox, err := element.BoundingBox()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"finding position in frame: %w\", err)\n\t}\n\n\treturn &Position{X: box.X, Y: box.Y}, nil\n}\n\nfunc (f *Frame) removeChildFrame(child *Frame) {\n\tf.log.Debugf(\"Frame:removeChildFrame\", \"fid:%s furl:%q cfid:%s curl:%q\",\n\t\tf.ID(), f.URL(), child.ID(), child.URL())\n\n\tf.childFramesMu.Lock()\n\tdefer f.childFramesMu.Unlock()\n\n\tdelete(f.childFrames, child)\n}\n\nfunc (f *Frame) setContext(world executionWorld, execCtx frameExecutionContext) {\n\tf.executionContextMu.Lock()\n\tdefer f.executionContextMu.Unlock()","sourceCodeStart":375,"sourceCodeEnd":411,"githubUrl":"https://github.com/grafana/k6/blob/3fcf5388d78cb382f0c0d42ec556a06bfd1b8dee/internal/js/modules/k6/browser/common/frame.go#L375-L411","documentation":"Returned by Frame.position when computing the iframe's offset via its frame element's BoundingBox fails. Only the wrap is added here; the underlying BoundingBox error (detached element, hidden frame, CDP error) carries the cause. Position calculation is needed for coordinate translation of actions inside iframes.","triggerScenarios":"Thrown at internal/js/modules/k6/browser/common/frame.go:388 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure the iframe is visible and rendered before measuring","Retry after layout settles (animations/loading finished)","Check wrapped error: hidden or zero-size iframes cannot yield positions"],"exampleFix":null,"handlingStrategy":"retry","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"}