grafana/k6 · error

parsing waitForURL options

Error message

parsing waitForURL options: %w

What it means

Wrap of an options-parsing failure in FrameWaitForURLOptions.Parse: the options object given to frame.waitForURL() is iterated key by key, and the wrapped error fires when a value cannot be applied — most commonly an unrecognized waitUntil lifecycle value (must be one of the LifecycleEvent names like "load" or "domcontentloaded"), a non-numeric timeout, or an unsupported key.

Solutions

  1. Use a supported waitUntil value: 'load' or 'domcontentloaded'
  2. Pass timeout as a number in milliseconds
  3. Spell option keys exactly as documented (timeout, waitUntil)
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at internal/js/modules/k6/browser/common/frame_options.go:826 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of grafana/k6@01ffac6f24 (2026-08-18). Data as JSON: /api/errors/6ce2861842984f5e. Report an issue: GitHub.

Appendix: source

Thrown at internal/js/modules/k6/browser/common/frame_options.go:826

	return &FrameWaitForURLOptions{
		Timeout:   defaultTimeout,
		WaitUntil: LifecycleEventLoad,
	}
}

// Parse parses the frame waitForURL options.
func (o *FrameWaitForURLOptions) Parse(ctx context.Context, opts sobek.Value) error {
	rt := k6ext.Runtime(ctx)
	if !common.IsNullish(opts) {
		opts := opts.ToObject(rt)
		for _, k := range opts.Keys() {
			switch k {
			case "timeout":
				o.Timeout = time.Duration(opts.Get(k).ToInteger()) * time.Millisecond
			case "waitUntil":
				lifeCycle := opts.Get(k).String()
				if err := o.WaitUntil.UnmarshalText([]byte(lifeCycle)); err != nil {
					return fmt.Errorf("parsing waitForURL options: %w", err)
				}
			}
		}
	}
	return nil
}

View on GitHub (pinned to 01ffac6f24)