{"record":{"id":"66bb6b65d81c25c7","repo":"grafana/k6","slug":"parsing-goto-options-w","errorCode":null,"errorMessage":"parsing goto options: %w","messagePattern":"parsing goto options: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/browser/common/frame_options.go","lineNumber":320,"sourceCode":"\t\tWaitUntil: LifecycleEventLoad,\n\t}\n}\n\n// Parse parses the frame goto options.\nfunc (o *FrameGotoOptions) Parse(ctx context.Context, opts sobek.Value) error {\n\trt := k6ext.Runtime(ctx)\n\tif !common.IsNullish(opts) {\n\t\topts := opts.ToObject(rt)\n\t\tfor _, k := range opts.Keys() {\n\t\t\tswitch k {\n\t\t\tcase \"referer\":\n\t\t\t\to.Referer = opts.Get(k).String()\n\t\t\tcase \"timeout\":\n\t\t\t\to.Timeout = time.Duration(opts.Get(k).ToInteger()) * time.Millisecond\n\t\t\tcase \"waitUntil\":\n\t\t\t\tlifeCycle := opts.Get(k).String()\n\t\t\t\tif err := o.WaitUntil.UnmarshalText([]byte(lifeCycle)); err != nil {\n\t\t\t\t\treturn fmt.Errorf(\"parsing goto options: %w\", err)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc NewFrameHoverOptions(defaultTimeout time.Duration) *FrameHoverOptions {\n\treturn &FrameHoverOptions{\n\t\tElementHandleHoverOptions: *NewElementHandleHoverOptions(defaultTimeout),\n\t\tStrict:                    false,\n\t}\n}\n\n// Parse parses the frame hover options.\nfunc (o *FrameHoverOptions) Parse(ctx context.Context, opts sobek.Value) error {\n\tif err := o.ElementHandleHoverOptions.Parse(ctx, opts); err != nil {\n\t\treturn err","sourceCodeStart":302,"sourceCodeEnd":338,"githubUrl":"https://github.com/grafana/k6/blob/93accf6570dcd306ca5e99cc44c393ee3797761b/internal/js/modules/k6/browser/common/frame_options.go#L302-L338","documentation":"FrameGotoOptions.Parse (frame_options.go:320) validates the `waitUntil` option of frame.goto()/page.goto() by calling LifecycleEvent.UnmarshalText. Only \"load\", \"domcontentloaded\" and \"networkidle\" are accepted (lifecycle.go:44-48); any other string makes UnmarshalText fail and the error is wrapped with this message. The invalid value never reaches Chromium — the call is rejected locally during option parsing.","triggerScenarios":"page.goto(url, { waitUntil: ... }) or frame.goto(url, { waitUntil: ... }) with a value such as 'network idle', 'complete', 'interactive', 'domContentLoaded', or a misspelling like 'netwrokidle'. The value is case-sensitive, so 'Load' also fails.","commonSituations":"Copy-pasting values from Playwright docs that k6 does not support (e.g. 'commit'), assuming space-separated names like 'network idle', or mixing capitalization from other frameworks.","solutions":["Use exactly one of: \"load\", \"domcontentloaded\", \"networkidle\" (lowercase) in the goto options","If you copied the script from Playwright/Puppeteer, map its waitUntil values to the three k6-supported ones","If the wait is too strict/loose, pick networkidle for full network quiet or domcontentloaded for a faster, weaker condition"],"exampleFix":"// before\npage.goto('https://example.com', { waitUntil: 'network idle' });\n\n// after\npage.goto('https://example.com', { waitUntil: 'networkidle' });","handlingStrategy":"validation","validationCode":"const WAIT_UNTIL = ['load', 'domcontentloaded', 'networkidle'];\nfunction validGotoOpts(o = {}) {\n  if (o.waitUntil !== undefined && !WAIT_UNTIL.includes(o.waitUntil)) {\n    throw new Error(`waitUntil must be one of ${WAIT_UNTIL.join(', ')} (got ${o.waitUntil})`);\n  }\n  return o;\n}\npage.goto(url, validGotoOpts(opts));","typeGuard":"function isWaitUntil(v: unknown): v is 'load' | 'domcontentloaded' | 'networkidle' {\n  return v === 'load' || v === 'domcontentloaded' || v === 'networkidle';\n}","tryCatchPattern":null,"preventionTips":["Define waitUntil once as a shared constant in the script","Remember values are case-sensitive and lowercase with no spaces"],"tags":["browser","options","waituntil","goto","validation"],"backgroundTag":null,"analyzedSha":"93accf6570dcd306ca5e99cc44c393ee3797761b","analyzedAt":"2026-08-15T21:23:27.118Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}