grafana/k6 · error
waiting for navigation to URL matching
Error message
waiting for navigation to URL matching %q: %w
What it means
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.
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)
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at internal/js/modules/k6/browser/common/frame.go:2184 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/e72f5dd16afad8ac.
Report an issue: GitHub.
Appendix: source
Thrown at internal/js/modules/k6/browser/common/frame.go:2192
// so we need to return nil explicitly.
if resp == nil {
return nil, nil //nolint:nilnil
}
return resp, nil
}
func (f *Frame) handleWaitForNavigationTimeoutErrorFn(opts *FrameWaitForNavigationOptions) func(err error) error {
return func(err error) error {
f.log.Debugf("Frame:WaitForNavigation",
"fid:%v furl:%s timeoutCtx done: %v", f.ID(), f.URL(), err)
if err != nil {
e := &k6ext.UserFriendlyError{
Err: err,
Timeout: opts.Timeout,
}
if opts.URL != "" {
return fmt.Errorf("waiting for navigation to URL matching %q: %w", opts.URL, e)
}
return fmt.Errorf("waiting for navigation: %w", e)
}
return nil
}
}
// WaitForSelector waits for the given selector to match the waiting criteria.
func (f *Frame) WaitForSelector(selector string, popts *FrameWaitForSelectorOptions) (*ElementHandle, error) {
handle, err := f.waitForSelectorRetry(selector, popts, maxRetry)
if err != nil {
return nil, fmt.Errorf("waiting for selector %q: %w", selector, err)
}
return handle, nil
}
View on GitHub (pinned to 3fcf5388d7)