{"record":{"id":"d1fe663e297e7c13","repo":"grafana/k6","slug":"translating-point-to-page-w","errorCode":null,"errorMessage":"translating point to page: %w","messagePattern":"translating point to page: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/browser/common/element_handle.go","lineNumber":1755,"sourceCode":"\n\t\t// Get the clickable point\n\t\tif p != nil {\n\t\t\tp, err = h.offsetPosition(apiCtx, opts.Position)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"getting element position: %w\", err)\n\t\t\t}\n\t\t} else {\n\t\t\tp, err = h.clickablePoint()\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"pointer action: %w\", err)\n\t\t\t}\n\t\t}\n\n\t\t// Further translation of the point might be necessary if the point\n\t\t// is still relative to the parent frame it is in and not the page.\n\t\t*p, err = h.translatePointToPage(apiCtx, *p)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"translating point to page: %w\", err)\n\t\t}\n\n\t\t// Do a final actionability check to see if element can receive events\n\t\t// at mouse position in question\n\t\tif !opts.Force {\n\t\t\tif ok, err := h.checkHitTargetAt(apiCtx, *p); !ok {\n\t\t\t\treturn nil, fmt.Errorf(\"checking hit target: %w\", err)\n\t\t\t}\n\t\t}\n\t\t// Are we only \"trialing\" the action but not actually performing\n\t\t// it (ie. running the actionability checks).\n\t\tif opts.Trial {\n\t\t\treturn nil, nil //nolint:nilnil\n\t\t}\n\n\t\tb := NewBarrier()\n\t\th.frame.manager.addBarrier(b)\n\t\tdefer h.frame.manager.removeBarrier(b)","sourceCodeStart":1737,"sourceCodeEnd":1773,"githubUrl":"https://github.com/grafana/k6/blob/93accf6570dcd306ca5e99cc44c393ee3797761b/internal/js/modules/k6/browser/common/element_handle.go#L1737-L1773","documentation":"For elements inside iframes, pointer actions must translate the frame-relative click point into page coordinates (translatePointToPage). This fails when the owner frame cannot be resolved ('checking hit target at ...' wrapper), the frame element cannot be fetched, or the parent frame's bounding box fails ('getting bounding box of parent frame') — typically because a frame in the chain navigated or detached mid-action.","triggerScenarios":"Clicking inside an iframe while that iframe (or its parent) navigates or is removed; frame tree mutated between the actionability check and translation; cross-origin iframe whose frame element evaluation fails.","commonSituations":"Ad widgets or embeds (payments, videos, maps) that reload on their own schedule; iframes swapped after login flows; clicking inside iframes on pages that periodically re-render their frame layout.","solutions":["Re-acquire the frame chain and element right before acting: const f = page.frame({ url }); const el = f.waitForSelector(...)","Wait for the iframe content to settle (f.waitForLoadState()) before pointer actions","Retry the action once — frame swaps are frequently transient","Avoid actions that intentionally navigate the iframe concurrently with the click"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"const frame = page.frame({ url: /embed/ });\nframe.waitForLoadState('load');\nconst el = frame.waitForSelector('#inner', { state: 'visible' });\nel.click();","typeGuard":null,"tryCatchPattern":"try {\n  el.click();\n} catch (e) {\n  if (String(e).includes('translating point to page')) {\n    // frame chain mutated mid-action: re-acquire frame and element, retry once\n    const f = page.frame({ url: /embed/ });\n    f.waitForSelector('#inner', { state: 'visible' }).click();\n  } else {\n    throw e;\n  }\n}","preventionTips":["Re-acquire frame-scoped elements right before acting","Let embedded iframes finish loading before pointer actions","Avoid clicking inside iframes that reload on their own schedule"],"tags":["browser","iframe","coordinates","race-condition","pointer-events"],"backgroundTag":null,"analyzedSha":"93accf6570dcd306ca5e99cc44c393ee3797761b","analyzedAt":"2026-08-15T21:23:27.118Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}