{"record":{"id":"1ee3d9bc863b1cfe","repo":"grafana/k6","slug":"getting-node-in-frame-w","errorCode":null,"errorMessage":"getting node in frame: %w","messagePattern":"getting node in frame: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/browser/common/element_handle.go","lineNumber":1156,"sourceCode":"\tdocumentHandle, ok := res.(*ElementHandle)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"unexpected result type while getting document element: %T\", res)\n\t}\n\tdefer func() {\n\t\tif err := documentHandle.Dispose(); err != nil {\n\t\t\terr = fmt.Errorf(\"disposing document element: %w\", err)\n\t\t\trerr = errors.Join(err, rerr)\n\t\t}\n\t}()\n\n\tif documentHandle.remoteObject.ObjectID == \"\" {\n\t\treturn nil, err\n\t}\n\n\tvar node *cdp.Node\n\taction := dom.DescribeNode().WithObjectID(documentHandle.remoteObject.ObjectID)\n\tif node, err = action.Do(cdp.WithExecutor(h.ctx, h.session)); err != nil {\n\t\treturn nil, fmt.Errorf(\"getting node in frame: %w\", err)\n\t}\n\tif node == nil || node.FrameID == \"\" {\n\t\treturn nil, fmt.Errorf(\"no frame found for node: %w\", err)\n\t}\n\n\tframe, ok := h.frame.manager.getFrameByID(node.FrameID)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"no frame found for id %s\", node.FrameID)\n\t}\n\n\treturn frame, nil\n}\n\n// Press scrolls element into view and presses the given keys.\nfunc (h *ElementHandle) Press(key string, opts *ElementHandlePressOptions) error {\n\tpress := func(apiCtx context.Context, handle *ElementHandle) (any, error) {\n\t\treturn nil, handle.press(apiCtx, key, KeyboardOptions{})\n\t}","sourceCodeStart":1138,"sourceCodeEnd":1174,"githubUrl":"https://github.com/grafana/k6/blob/3fcf5388d78cb382f0c0d42ec556a06bfd1b8dee/internal/js/modules/k6/browser/common/element_handle.go#L1138-L1174","documentation":"Returned by ElementHandle.OwnerFrame when the CDP dom.DescribeNode call, issued with the document element's remote object ID, fails while resolving which frame owns the element. It wraps the underlying CDP/DevTools error; typical causes are the target being closed, a navigation invalidating the remote object, or a session-level error. The element-to-frame mapping cannot be established when this fires.","triggerScenarios":"Thrown at internal/js/modules/k6/browser/common/element_handle.go:1156 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure the element handle is still valid (page/frame not navigated or closed) before calling ownerFrame-involving APIs","Re-query the element after navigation settles and retry the operation","Check browser and k6 logs for a closed session or CDP target error; restart the browser if the session died"],"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"}