{"record":{"id":"7e77a6afb94986a0","repo":"grafana/k6","slug":"parse-ishidden-options-of-selector-q-w-7e77a6","errorCode":null,"errorMessage":"parse isHidden options of selector %q: %w","messagePattern":"parse isHidden options of selector %q: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/browser/browser/page_mapping.go","lineNumber":328,"sourceCode":"\t\t\t\treturn nil, fmt.Errorf(\"parse isEditabled options of selector %q: %w\", selector, err)\n\t\t\t}\n\t\t\treturn promise(vu, func() (any, error) {\n\t\t\t\treturn p.IsEditable(selector, popts) //nolint:wrapcheck\n\t\t\t}), nil\n\t\t},\n\t\t\"isEnabled\": func(selector string, opts sobek.Value) (*sobek.Promise, error) {\n\t\t\tpopts, err := parseFrameIsEnabledOptions(rt, opts, p.MainFrame().Timeout())\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"parse isEnabled options of selector %q: %w\", selector, err)\n\t\t\t}\n\t\t\treturn promise(vu, func() (any, error) {\n\t\t\t\treturn p.IsEnabled(selector, popts) //nolint:wrapcheck\n\t\t\t}), nil\n\t\t},\n\t\t\"isHidden\": func(selector string, opts sobek.Value) (*sobek.Promise, error) {\n\t\t\tpopts, err := parseFrameIsHiddenOptions(rt, opts)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"parse isHidden options of selector %q: %w\", selector, err)\n\t\t\t}\n\t\t\treturn promise(vu, func() (any, error) {\n\t\t\t\treturn p.IsHidden(selector, popts) //nolint:wrapcheck\n\t\t\t}), nil\n\t\t},\n\t\t\"isVisible\": func(selector string, opts sobek.Value) (*sobek.Promise, error) {\n\t\t\tpopts, err := parseFrameIsVisibleOptions(rt, opts)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"parsing isVisible options of selector %q: %w\", selector, err)\n\t\t\t}\n\t\t\treturn promise(vu, func() (any, error) {\n\t\t\t\treturn p.IsVisible(selector, popts) //nolint:wrapcheck\n\t\t\t}), nil\n\t\t},\n\t\t\"keyboard\": mapKeyboard(vu, p.GetKeyboard()),\n\t\t\"locator\": func(selector string, opts sobek.Value) *sobek.Object {\n\t\t\tml := mapLocator(vu, p.Locator(selector, parseLocatorOptions(rt, opts)))\n\t\t\treturn rt.ToValue(ml).ToObject(rt)","sourceCodeStart":310,"sourceCodeEnd":346,"githubUrl":"https://github.com/grafana/k6/blob/8d06114777191d21ef885d05c5f8aa9e1ed838ae/internal/js/modules/k6/browser/browser/page_mapping.go#L310-L346","documentation":"Thrown synchronously by page.isVisible(selector, opts) when FrameIsVisibleOptions parsing fails. Strictness is read via parseStrict (internal/js/modules/k6/browser/common/frame_options.go:784-798), which only ToBoolean-coerces the 'strict' key and never fails, so on stock k6 this wrapper is defensive/unreachable. isVisible notably does not accept a timeout (hidden/visible checks are immediate), so any timeout key is ignored.","triggerScenarios":"Not reachable with current stock code; a custom parser validating the opts shape could raise it. Passing { timeout: ... } to isVisible is silently ignored rather than erroring.","commonSituations":"Assuming isVisible supports timeout like other page methods and being surprised it is ignored; custom builds with added validation.","solutions":["Pass only { strict: boolean } — isVisible takes no timeout","For timed waits use waitForSelector with a state option instead of isVisible","Verify the option schema on customized builds"],"exampleFix":"// before\nawait page.isVisible('#banner', { timeout: 5000 });  // timeout ignored\n\n// after\nawait page.isVisible('#banner', { strict: true });\n// or for a timed wait:\nawait page.waitForSelector('#banner', { state: 'visible', timeout: 5000 });","handlingStrategy":"validation","validationCode":"const ALLOWED = new Set(['strict']);\nconst bad = Object.keys(opts ?? {}).filter(k => !ALLOWED.has(k));\nif (bad.length) console.warn(`isVisible ignores unknown options: ${bad.join(', ')} (no timeout support)`);\nif (opts?.strict !== undefined && typeof opts.strict !== 'boolean') {\n  throw new Error('isVisible strict must be a boolean');\n}\nawait page.isVisible(selector, opts);","typeGuard":"/** @param {unknown} o */\nfunction isVisibleOpts(o) {\n  if (o === undefined || o === null) return true;\n  if (typeof o !== 'object') return false;\n  const s = /** @type {any} */ (o).strict;\n  return s === undefined || typeof s === 'boolean';\n}","tryCatchPattern":"try {\n  return await page.isVisible(selector, opts);\n} catch (e) {\n  if (String(e).includes('isVisible options')) {\n    return await page.isVisible(selector);\n  } throw e;\n}","preventionTips":["isVisible supports only strict — it takes no timeout because visibility is checked immediately","For timed visibility waits use waitForSelector with state: 'visible' and a timeout","Do not copy option objects from click/hover calls into isVisible"],"tags":["k6","browser","page","is-visible","options","strict"],"backgroundTag":"invalid-option-type","analyzedSha":"8d06114777191d21ef885d05c5f8aa9e1ed838ae","analyzedAt":"2026-09-14T20:10:14.619Z","contentChangedAt":"2026-09-14T20:10:14.619Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}