grafana/k6 · error
parsing waitForFunction options: %w
Error message
parsing waitForFunction options: %w
What it means
Error "parsing waitForFunction options: %w" thrown in grafana/k6.
Source
Thrown at internal/js/modules/k6/browser/browser/page_mapping.go:822
return nil, nil
})
if pageEvent.wait {
if _, err := wait(); errors.Is(err, context.Canceled) {
return errors.New("iteration ended before page.on handler completed executing")
}
}
return nil
})
}
}
func parseWaitForFunctionArgs(
ctx context.Context, timeout time.Duration, pageFunc, opts sobek.Value, gargs ...sobek.Value,
) (string, *common.FrameWaitForFunctionOptions, []any, error) {
popts := common.NewFrameWaitForFunctionOptions(timeout)
err := popts.Parse(ctx, opts)
if err != nil {
return "", nil, nil, fmt.Errorf("parsing waitForFunction options: %w", err)
}
js := pageFunc.ToString().String()
_, isCallable := sobek.AssertFunction(pageFunc)
if !isCallable {
js = fmt.Sprintf("() => (%s)", js)
}
return js, popts, exportArgs(gargs), nil
}
// parseStringOrRegex parses a sobek.Value to return either a quoted string if it was a string,
// or a raw string if it was a JS RegExp object or another type.
//
// Some getBy* APIs work with single quotes and some work with double quotes.
// This inconsistency seems to stem from the injected code copied from
// Playwright itself.
//View on GitHub (pinned to 93accf6570)
When it happens
Trigger: Thrown at internal/js/modules/k6/browser/browser/page_mapping.go:822 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of grafana/k6@93accf6570 (2026-08-15).
Data as JSON: /api/errors/0ac5f2ff3984fdbf.
Report an issue: GitHub.