{"record":{"id":"8d795f5c1a892ddc","repo":"grafana/k6","slug":"getting-position-of-parent-frame-w","errorCode":null,"errorMessage":"getting position of parent frame: %w","messagePattern":"getting position of parent frame: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/browser/common/element_handle.go","lineNumber":83,"sourceCode":"\tvar err error\n\taction := dom.GetBoxModel().WithObjectID(h.remoteObject.ObjectID)\n\tif box, err = action.Do(cdp.WithExecutor(h.ctx, h.session)); err != nil {\n\t\treturn nil, fmt.Errorf(\"getting bounding box model of DOM node: %w\", err)\n\t}\n\n\tif box == nil || box.Border == nil {\n\t\treturn nil, ErrElementNotAttachedToDOM\n\t}\n\n\tquad := box.Border\n\tx := math.Min(quad[0], math.Min(quad[2], math.Min(quad[4], quad[6])))\n\ty := math.Min(quad[1], math.Min(quad[3], math.Min(quad[5], quad[7])))\n\twidth := math.Max(quad[0], math.Max(quad[2], math.Max(quad[4], quad[6]))) - x\n\theight := math.Max(quad[1], math.Max(quad[3], math.Max(quad[5], quad[7]))) - y\n\n\tposition, err := h.frame.position()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"getting position of parent frame: %w\", err)\n\t}\n\n\treturn &Rect{X: x + position.X, Y: y + position.Y, Width: width, Height: height}, nil\n}\n\n// translatePointToPage translates the point to the page's coordinates if the\n// point is relative to the parent frame.\nfunc (h *ElementHandle) translatePointToPage(apiCtx context.Context, point Position) (Position, error) {\n\th.logger.Debugf(\"ElementHandle:translatePointToPage\", \"point before translation: %v\", point)\n\n\tframe, err := h.ownerFrame(apiCtx)\n\tif err != nil {\n\t\treturn Position{}, fmt.Errorf(\"checking hit target at %v: %w\", point, err)\n\t}\n\n\tif frame == nil || frame.parentFrame == nil {\n\t\th.logger.Debugf(\"ElementHandle:translatePointToPage\", \"no parent frame\")\n\t\treturn point, nil","sourceCodeStart":65,"sourceCodeEnd":101,"githubUrl":"https://github.com/grafana/k6/blob/3fcf5388d78cb382f0c0d42ec556a06bfd1b8dee/internal/js/modules/k6/browser/common/element_handle.go#L65-L101","documentation":"While converting an element's box-model coordinates to page coordinates, frame.position() failed for the parent (likely OOP) iframe — typically because the iframe's layout object or execution context is unavailable (detached frame, not-yet-loaded OOP frame).","triggerScenarios":"Thrown at internal/js/modules/k6/browser/common/element_handle.go:83 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Wait for the frame to load before measuring (frame.waitForLoadState)","Re-acquire the element handle after navigation","Retry once the iframe finishes rendering"],"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"}