{"record":{"id":"78d4a4b394c919af","repo":"grafana/k6","slug":"waiting-for-url-q-w","errorCode":null,"errorMessage":"waiting for URL %q: %w","messagePattern":"waiting for URL %q: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/browser/common/frame.go","lineNumber":2232,"sourceCode":"\n\tf.log.Debugf(\"Frame:WaitForTimeout\", \"fid:%s furl:%q timeout:%s\", f.ID(), f.URL(), to)\n\tdefer f.log.Debugf(\"Frame:WaitForTimeout:return\", \"fid:%s furl:%q timeout:%s\", f.ID(), f.URL(), to)\n\n\tselect {\n\tcase <-f.ctx.Done():\n\tcase <-time.After(to):\n\t}\n}\n\n// WaitForURL waits for the frame to navigate to a URL matching the given pattern.\n// RegExMatcher should be non-nil to be able to test against a URL pattern.\nfunc (f *Frame) WaitForURL(urlPattern string, opts *FrameWaitForURLOptions, rm RegExMatcher) error {\n\tf.log.Debugf(\"Frame:WaitForURL\", \"fid:%s furl:%q pattern:%s\", f.ID(), f.URL(), urlPattern)\n\tdefer f.log.Debugf(\"Frame:WaitForURL:return\", \"fid:%s furl:%q pattern:%s\", f.ID(), f.URL(), urlPattern)\n\n\tmatched, err := rm.Match(urlPattern, f.URL())\n\tif err != nil {\n\t\treturn fmt.Errorf(\"waiting for URL %q: %w\", urlPattern, err)\n\t}\n\tif matched {\n\t\t// Already at target URL, just wait for load state\n\t\treturn f.WaitForLoadState(opts.WaitUntil.String(), &FrameWaitForLoadStateOptions{\n\t\t\tTimeout: opts.Timeout,\n\t\t})\n\t}\n\n\t// Wait for navigation to matching URL\n\tnavOpts := &FrameWaitForNavigationOptions{\n\t\tURL:       urlPattern,\n\t\tTimeout:   opts.Timeout,\n\t\tWaitUntil: opts.WaitUntil,\n\t}\n\t_, err = f.WaitForNavigation(navOpts, rm)\n\n\treturn err\n}","sourceCodeStart":2214,"sourceCodeEnd":2250,"githubUrl":"https://github.com/grafana/k6/blob/3fcf5388d78cb382f0c0d42ec556a06bfd1b8dee/internal/js/modules/k6/browser/common/frame.go#L2214-L2250","documentation":"Returned by Frame.WaitForURL when waiting for navigation to a URL matching the pattern fails or times out (it delegates to WaitForNavigation with the URL set). The wrap names the pattern; the underlying timeout/error explains why the frame never reached a matching URL.","triggerScenarios":"Thrown at internal/js/modules/k6/browser/common/frame.go:2224 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the URL pattern matches the destination (glob/regex semantics)","Increase the timeout","Ensure the navigation actually happens (click/link triggered)","For SPA hash changes, confirm a real navigation occurs"],"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"}