grafana/k6 · error
getProperties: %w
Error message
getProperties: %w
What it means
Once selectOption succeeds, k6 calls Runtime.getProperties on the returned array handle to enumerate the chosen <option> elements. If that CDP call fails (session closed, context destroyed, protocol error), you get 'getProperties: <cause>'. The selection itself worked; only reading back the result failed.
Source
Thrown at internal/js/modules/k6/browser/common/frame.go:1734
return handle.selectOption(apiCtx, values)
}
act := f.newAction(
selector, DOMElementStateAttached, opts.Strict, selectOption,
[]string{}, opts.Force, withRetry, opts.NoWaitAfter, opts.Timeout,
)
v, err := call(f.ctx, act, opts.Timeout)
if err != nil {
return nil, errorFromDOMError(err)
}
selectHandle, ok := v.(jsHandle)
if !ok {
return nil, fmt.Errorf("unexpected select element type %T", v)
}
// pack the selected <option> values inside <select> into a slice
optHandles, err := selectHandle.getProperties()
if err != nil {
return nil, fmt.Errorf("getProperties: %w", err)
}
vals := make([]string, 0, len(optHandles))
for _, oh := range optHandles {
val, err := oh.JSONValue()
if err != nil {
return nil, fmt.Errorf("reading value: %w", err)
}
vals = append(vals, val)
if err := oh.dispose(); err != nil {
return nil, fmt.Errorf("optionHandle.dispose: %w", err)
}
}
if err := selectHandle.dispose(); err != nil {
return nil, fmt.Errorf("selectHandle.dispose: %w", err)
}
return vals, nil
}View on GitHub (pinned to 93accf6570)
Solutions
- Prevent the submit/reload during selection (e.g. event.preventDefault in an addInitScript, or select a value that does not trigger navigation) if you only need the return value.
- Delay page.close() until after selectOption returns.
- If you do not need the selected values, ignore the error path by wrapping the call and treating this specific failure as success-after-verify (re-read values with evaluate later).
Example fix
// before
await page.selectOption('#country', 'JP'); // onchange submits form -> readback races
// after
await page.evaluate(() => {
document.querySelector('#country').addEventListener('change', e => e.preventDefault());
});
await page.selectOption('#country', 'JP'); Defensive patterns
Strategy: try-catch
Validate before calling
await frame.evaluate(() => {
document.querySelector('#sel')?.addEventListener('change', e => e.preventDefault());
}); Try / catch
try { return await page.selectOption(sel, v); }
catch (e) {
if (/getProperties/.test(e.message)) {
return page.evaluate(() => [...document.querySelector(sel).selectedOptions].map(o => o.value));
}
throw e;
} Prevention
- Prevent form submit/reload on change when you only need the return value
- Do not close the page immediately after selecting
- Read selected values via evaluate when the page navigates on change
When it happens
Trigger: Navigation or frame detach between the selectOption click completing and the getProperties readback; CDP session dropped (browser crash, page closed by the site); debugger attached interfering with the protocol.
Common situations: onchange handlers that submit the form / reload the page immediately after selection — the readback races the navigation; tests that close the page in a helper right after selecting.
Related errors
- getting node in frame: %w
- resolving DOM node: %w
- the page may have navigated away or the element is now mi
- describing DOM node: %w
- optionHandle.dispose: %w
AI-assisted analysis of grafana/k6@93accf6570 (2026-08-15).
Data as JSON: /api/errors/142fb9bc956d3030.
Report an issue: GitHub.