{"record":{"id":"cd6b72841bb07558","repo":"grafana/k6","slug":"waiting-for-q-w","errorCode":null,"errorMessage":"waiting for %q: %w","messagePattern":"waiting for %q: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/browser/common/locator.go","lineNumber":653,"sourceCode":"\n\topts.Strict = true\n\tif err := l.frame.dispatchEvent(l.selector, typ, eventInit, opts); err != nil {\n\t\treturn fmt.Errorf(\"dispatching locator event %q to %q: %w\", typ, l.selector, err)\n\t}\n\n\tapplySlowMo(l.ctx)\n\n\treturn nil\n}\n\n// WaitFor waits for the element matching the locator's selector with strict mode on.\nfunc (l *Locator) WaitFor(opts *FrameWaitForSelectorOptions) error {\n\tl.log.Debugf(\"Locator:WaitFor\", \"fid:%s furl:%q sel:%q opts:%+v\", l.frame.ID(), l.frame.URL(), l.selector, opts)\n\n\topts.Strict = true\n\t_, err := l.frame.waitFor(l.selector, opts, 20)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"waiting for %q: %w\", l.selector, err)\n\t}\n\n\treturn nil\n}\n\n// DefaultTimeout returns the default timeout for the locator.\n// This is an internal API and should not be used by users.\nfunc (l *Locator) DefaultTimeout() time.Duration {\n\treturn l.frame.defaultTimeout()\n}\n\n// FrameLocator represent a way to find element(s) in an iframe.\ntype FrameLocator struct {\n\tselector string\n\n\tframe *Frame\n\n\tctx context.Context","sourceCodeStart":635,"sourceCodeEnd":671,"githubUrl":"https://github.com/grafana/k6/blob/01ffac6f245854c1b8adc6a69857c76a15f90022/internal/js/modules/k6/browser/common/locator.go#L635-L671","documentation":"Wrapped failure from Frame.waitFor (bounded to 20 internal attempts) while waiting for the element matching the locator's selector (strict mode forced). Fires when the element does not reach the required state within the timeout, or when the wait loop exhausts retries or the CDP query fails.","triggerScenarios":"Thrown at internal/js/modules/k6/browser/common/locator.go:653 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Increase the timeout in FrameWaitForSelectorOptions for slow pages","Ensure the selector is correct and matches a single element","Wait for preceding navigation/rendering steps before waiting on the element"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"01ffac6f245854c1b8adc6a69857c76a15f90022","analyzedAt":"2026-08-18T03:05:52.393Z","contentChangedAt":"2026-08-18T03:05:52.393Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}