grafana/k6 · error
finding position in frame
Error message
finding position in frame: %w
What it means
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.
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
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at internal/js/modules/k6/browser/common/frame.go:388 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of grafana/k6@3fcf5388d7 (2026-08-18).
Data as JSON: /api/errors/ad0b41a2bb231f08.
Report an issue: GitHub.
Appendix: source
Thrown at internal/js/modules/k6/browser/common/frame.go:393
// website never stops performing network requests.
}
func (f *Frame) position() (*Position, error) {
frame, ok := f.manager.getFrameByID(cdp.FrameID(f.page.targetID))
if !ok {
return nil, fmt.Errorf("could not find frame with id %s", f.page.targetID)
}
if frame == f.page.frameManager.MainFrame() {
return &Position{X: 0, Y: 0}, nil
}
element, err := frame.FrameElement()
if err != nil {
return nil, err
}
box, err := element.BoundingBox()
if err != nil {
return nil, fmt.Errorf("finding position in frame: %w", err)
}
return &Position{X: box.X, Y: box.Y}, nil
}
func (f *Frame) removeChildFrame(child *Frame) {
f.log.Debugf("Frame:removeChildFrame", "fid:%s furl:%q cfid:%s curl:%q",
f.ID(), f.URL(), child.ID(), child.URL())
f.childFramesMu.Lock()
defer f.childFramesMu.Unlock()
delete(f.childFrames, child)
}
func (f *Frame) setContext(world executionWorld, execCtx frameExecutionContext) {
f.executionContextMu.Lock()
defer f.executionContextMu.Unlock()View on GitHub (pinned to 3fcf5388d7)