{"record":{"id":"5fa0dc4e0086c9b7","repo":"grafana/k6","slug":"getting-frame-element-w","errorCode":null,"errorMessage":"getting frame element: %w","messagePattern":"getting frame element: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/browser/common/frame.go","lineNumber":998,"sourceCode":"\t}\n\tact := f.newAction(\n\t\tselector, DOMElementStateAttached, opts.Strict, focus,\n\t\t[]string{}, false, withRetry, true, opts.Timeout,\n\t)\n\tif _, err := call(f.ctx, act, opts.Timeout); err != nil {\n\t\treturn errorFromDOMError(err)\n\t}\n\n\treturn nil\n}\n\n// FrameElement returns the element handle for the frame.\nfunc (f *Frame) FrameElement() (*ElementHandle, error) {\n\tf.log.Debugf(\"Frame:FrameElement\", \"fid:%s furl:%q\", f.ID(), f.URL())\n\n\telement, err := f.page.getFrameElement(f)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"getting frame element: %w\", err)\n\t}\n\treturn element, nil\n}\n\n// GetAttribute of the first element found that matches the selector.\n// The second return value is true if the attribute exists, and false otherwise.\nfunc (f *Frame) GetAttribute(selector, name string, popts *FrameBaseOptions) (string, bool, error) {\n\tf.log.Debugf(\"Frame:GetAttribute\", \"fid:%s furl:%q sel:%q name:%s\", f.ID(), f.URL(), selector, name)\n\n\ts, ok, err := f.getAttribute(selector, name, popts)\n\tif err != nil {\n\t\treturn \"\", false, fmt.Errorf(\"getting attribute %q of %q: %w\", name, selector, err)\n\t}\n\n\treturn s, ok, nil\n}\n\nfunc (f *Frame) getAttribute(selector, name string, opts *FrameBaseOptions) (string, bool, error) {","sourceCodeStart":980,"sourceCodeEnd":1016,"githubUrl":"https://github.com/grafana/k6/blob/3fcf5388d78cb382f0c0d42ec556a06bfd1b8dee/internal/js/modules/k6/browser/common/frame.go#L980-L1016","documentation":"Returned by Frame.FrameElement when page.getFrameElement fails to resolve the element handle representing this frame (the <iframe> element in the parent). The wrapped error covers CDP node resolution failures — typically the frame was detached or the parent navigated.","triggerScenarios":"Thrown at internal/js/modules/k6/browser/common/frame.go:990 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure the iframe is still attached to the parent","Retry after navigation settles","Avoid querying the frame element during teardown"],"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"}