grafana/k6 · error
parse isHidden options of selector
Error message
parse isHidden options of selector %q: %w
What it means
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.
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
Example fix
// before
await page.isVisible('#banner', { timeout: 5000 }); // timeout ignored
// after
await page.isVisible('#banner', { strict: true });
// or for a timed wait:
await page.waitForSelector('#banner', { state: 'visible', timeout: 5000 }); Defensive patterns
Strategy: validation
Validate before calling
const ALLOWED = new Set(['strict']);
const bad = Object.keys(opts ?? {}).filter(k => !ALLOWED.has(k));
if (bad.length) console.warn(`isVisible ignores unknown options: ${bad.join(', ')} (no timeout support)`);
if (opts?.strict !== undefined && typeof opts.strict !== 'boolean') {
throw new Error('isVisible strict must be a boolean');
}
await page.isVisible(selector, opts); Type guard
/** @param {unknown} o */
function isVisibleOpts(o) {
if (o === undefined || o === null) return true;
if (typeof o !== 'object') return false;
const s = /** @type {any} */ (o).strict;
return s === undefined || typeof s === 'boolean';
} Try / catch
try {
return await page.isVisible(selector, opts);
} catch (e) {
if (String(e).includes('isVisible options')) {
return await page.isVisible(selector);
} throw e;
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: Assuming isVisible supports timeout like other page methods and being surprised it is ignored; custom builds with added validation.
Related errors
- parse isVisible options of selector
- parse isChecked options of selector
- parse isDisabled options of selector
- parse isEditabled options of selector
- parse isEnabled options of selector
AI-assisted analysis of grafana/k6@8d06114777 (2026-09-14).
Data as JSON: /api/errors/7e77a6afb94986a0.
Report an issue: GitHub.
Appendix: source
Thrown at internal/js/modules/k6/browser/browser/page_mapping.go:328
return nil, fmt.Errorf("parse isEditabled options of selector %q: %w", selector, err)
}
return promise(vu, func() (any, error) {
return p.IsEditable(selector, popts) //nolint:wrapcheck
}), nil
},
"isEnabled": func(selector string, opts sobek.Value) (*sobek.Promise, error) {
popts, err := parseFrameIsEnabledOptions(rt, opts, p.MainFrame().Timeout())
if err != nil {
return nil, fmt.Errorf("parse isEnabled options of selector %q: %w", selector, err)
}
return promise(vu, func() (any, error) {
return p.IsEnabled(selector, popts) //nolint:wrapcheck
}), nil
},
"isHidden": func(selector string, opts sobek.Value) (*sobek.Promise, error) {
popts, err := parseFrameIsHiddenOptions(rt, opts)
if err != nil {
return nil, fmt.Errorf("parse isHidden options of selector %q: %w", selector, err)
}
return promise(vu, func() (any, error) {
return p.IsHidden(selector, popts) //nolint:wrapcheck
}), nil
},
"isVisible": func(selector string, opts sobek.Value) (*sobek.Promise, error) {
popts, err := parseFrameIsVisibleOptions(rt, opts)
if err != nil {
return nil, fmt.Errorf("parsing isVisible options of selector %q: %w", selector, err)
}
return promise(vu, func() (any, error) {
return p.IsVisible(selector, popts) //nolint:wrapcheck
}), nil
},
"keyboard": mapKeyboard(vu, p.GetKeyboard()),
"locator": func(selector string, opts sobek.Value) *sobek.Object {
ml := mapLocator(vu, p.Locator(selector, parseLocatorOptions(rt, opts)))
return rt.ToValue(ml).ToObject(rt)View on GitHub (pinned to 8d06114777)