{"record":{"id":"e72f5dd16afad8ac","repo":"grafana/k6","slug":"waiting-for-navigation-to-url-matching-q-w","errorCode":null,"errorMessage":"waiting for navigation to URL matching %q: %w","messagePattern":"waiting for navigation to URL matching %q: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/browser/common/frame.go","lineNumber":2192,"sourceCode":"\t// so we need to return nil explicitly.\n\tif resp == nil {\n\t\treturn nil, nil //nolint:nilnil\n\t}\n\n\treturn resp, nil\n}\n\nfunc (f *Frame) handleWaitForNavigationTimeoutErrorFn(opts *FrameWaitForNavigationOptions) func(err error) error {\n\treturn func(err error) error {\n\t\tf.log.Debugf(\"Frame:WaitForNavigation\",\n\t\t\t\"fid:%v furl:%s timeoutCtx done: %v\", f.ID(), f.URL(), err)\n\t\tif err != nil {\n\t\t\te := &k6ext.UserFriendlyError{\n\t\t\t\tErr:     err,\n\t\t\t\tTimeout: opts.Timeout,\n\t\t\t}\n\t\t\tif opts.URL != \"\" {\n\t\t\t\treturn fmt.Errorf(\"waiting for navigation to URL matching %q: %w\", opts.URL, e)\n\t\t\t}\n\t\t\treturn fmt.Errorf(\"waiting for navigation: %w\", e)\n\t\t}\n\n\t\treturn nil\n\t}\n}\n\n// WaitForSelector waits for the given selector to match the waiting criteria.\nfunc (f *Frame) WaitForSelector(selector string, popts *FrameWaitForSelectorOptions) (*ElementHandle, error) {\n\thandle, err := f.waitForSelectorRetry(selector, popts, maxRetry)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"waiting for selector %q: %w\", selector, err)\n\t}\n\n\treturn handle, nil\n}\n","sourceCodeStart":2174,"sourceCodeEnd":2210,"githubUrl":"https://github.com/grafana/k6/blob/3fcf5388d78cb382f0c0d42ec556a06bfd1b8dee/internal/js/modules/k6/browser/common/frame.go#L2174-L2210","documentation":"Produced by the WaitForNavigation timeout handler when a URL pattern was configured and the wait failed: the wrapped UserFriendlyError couples the underlying cause with the configured timeout. It fires when no navigation matching the pattern completes in time.","triggerScenarios":"Thrown at internal/js/modules/k6/browser/common/frame.go:2184 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Increase the timeout option","Verify the URL pattern actually matches the target navigation (glob/regex)","Trigger the navigation before or while waiting, not after","Check the page actually navigates (no SPA soft-routing if pattern expects a URL change)"],"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"}