{"record":{"id":"17b9b8efabaaaa3b","repo":"grafana/k6","slug":"parsing-locator-press-sequentially-options-w","errorCode":null,"errorMessage":"parsing locator press sequentially options: %w","messagePattern":"parsing locator press sequentially options: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/browser/browser/locator_mapping.go","lineNumber":381,"sourceCode":"\t\t\t}\n\t\t\treturn promise(vu, func() (any, error) {\n\t\t\t\treturn lo.SelectOption(convValues, copts) //nolint:wrapcheck\n\t\t\t}), nil\n\t\t},\n\t\t\"press\": func(key string, opts sobek.Value) (*sobek.Promise, error) {\n\t\t\tcopts := common.NewFramePressOptions(lo.Timeout())\n\t\t\tif err := copts.Parse(vu.Context(), opts); err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"parsing press options: %w\", err)\n\t\t\t}\n\t\t\treturn promise(vu, func() (any, error) {\n\t\t\t\treturn nil, lo.Press(key, copts) //nolint:wrapcheck\n\t\t\t}), nil\n\t\t},\n\n\t\t\"pressSequentially\": func(text string, opts sobek.Value) (*sobek.Promise, error) {\n\t\t\tcopts := common.NewFrameTypeOptions(lo.Timeout())\n\t\t\tif err := copts.Parse(vu.Context(), opts); err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"parsing locator press sequentially options: %w\", err)\n\t\t\t}\n\t\t\treturn promise(vu, func() (any, error) {\n\t\t\t\treturn nil, lo.PressSequentially(text, copts) //nolint:wrapcheck\n\t\t\t}), nil\n\t\t},\n\n\t\t\"type\": func(text string, opts sobek.Value) (*sobek.Promise, error) {\n\t\t\tcopts := common.NewFrameTypeOptions(lo.Timeout())\n\t\t\tif err := copts.Parse(vu.Context(), opts); err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"parsing type options: %w\", err)\n\t\t\t}\n\t\t\treturn promise(vu, func() (any, error) {\n\t\t\t\treturn nil, lo.Type(text, copts) //nolint:wrapcheck\n\t\t\t}), nil\n\t\t},\n\t\t\"hover\": func(opts sobek.Value) (*sobek.Promise, error) {\n\t\t\tcopts := common.NewFrameHoverOptions(lo.Timeout())\n\t\t\tif err := copts.Parse(vu.Context(), opts); err != nil {","sourceCodeStart":363,"sourceCodeEnd":399,"githubUrl":"https://github.com/grafana/k6/blob/93accf6570dcd306ca5e99cc44c393ee3797761b/internal/js/modules/k6/browser/browser/locator_mapping.go#L363-L399","documentation":"Thrown when locator.pressSequentially(text, opts) fails to parse options into FrameTypeOptions (delay number in ms between keystrokes, timeout number in ms; strict). The mapping wraps the cause as 'parsing locator press sequentially options: %w'. pressSequentially is the current name for the deprecated type(); its options parser is lenient in current k6, so failures come from a non-object opts argument or wrong-typed fields under strict parsing.","triggerScenarios":"Calling pressSequentially('hello', '50ms') or pressSequentially('hello', 50) — scalar in the opts slot; { delay: '50ms' } string instead of number; passing the text into the options object instead of the first argument.","commonSituations":"Renaming type() to pressSequentially() during Playwright-alignment migrations and leaving old string-typed arguments; simulating human typing with per-key delays expressed as strings; copy-pasting fill() options which accepts different keys.","solutions":["Pass options as a plain object: pressSequentially('hello', { delay: 50 })","Use numeric milliseconds for delay and timeout","Keep the text as the first argument","Omit options when the default no-delay behavior is acceptable"],"exampleFix":"// before\nawait page.locator('input').pressSequentially('k6', '50ms');\n\n// after\nawait page.locator('input').pressSequentially('k6', { delay: 50 });","handlingStrategy":"validation","validationCode":"function assertTypeOpts(method, opts) {\n  if (opts === null || opts === undefined) return;\n  if (typeof opts !== 'object' || Array.isArray(opts)) {\n    throw new TypeError(`${method} options must be a plain object`);\n  }\n  for (const k of ['delay', 'timeout']) {\n    if (k in opts && typeof opts[k] !== 'number') {\n      throw new TypeError(`${method} ${k} must be a number (ms)`);\n    }\n  }\n}\nassertTypeOpts('pressSequentially', opts);","typeGuard":"function isTypeOptions(v) {\n  if (v === null || v === undefined) return true;\n  if (typeof v !== 'object' || Array.isArray(v)) return false;\n  return (v.delay === undefined || typeof v.delay === 'number') &&\n         (v.timeout === undefined || typeof v.timeout === 'number');\n}","tryCatchPattern":"try {\n  await locator.pressSequentially(text, opts);\n} catch (e) {\n  if (/parsing locator press sequentially options/.test(String(e.message))) {\n    throw new Error(`Bad pressSequentially options: ${JSON.stringify(opts)}`);\n  }\n  throw e;\n}","preventionTips":["When migrating from type(), re-check the options shape instead of copying arguments","Use numeric milliseconds for delay between keystrokes","Keep the typed text as the first argument"],"tags":["k6","browser","locator","options","presssequentially"],"backgroundTag":null,"analyzedSha":"93accf6570dcd306ca5e99cc44c393ee3797761b","analyzedAt":"2026-08-15T21:23:27.118Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}