microsoft/playwright · error · NonRecoverableDOMError
Did not find some options
Error message
Did not find some options
What it means
selectOption returned 'error:optionsnotfound', meaning some of the requested option values/labels do not exist in the <select>. With force:true or noAutoWaiting the retry loop cannot wait for options to appear, so it throws NonRecoverableDOMError('Did not find some options').
Source
Thrown at packages/playwright-core/src/server/dom.ts:354
if (!options.skipActionPreChecks && !options.force && !noAutoWaiting)
await this._frame._page.performActionPreChecks(progress);
const result = await action(progress, retry);
++retry;
if (result === 'error:notvisible') {
if (options.force || noAutoWaiting)
throw new NonRecoverableDOMError('Element is not visible');
progress.log(' element is not visible');
continue;
}
if (result === 'error:notinviewport') {
if (options.force || noAutoWaiting)
throw new NonRecoverableDOMError('Element is outside of the viewport');
progress.log(' element is outside of the viewport');
continue;
}
if (result === 'error:optionsnotfound') {
if (noAutoWaiting)
throw new NonRecoverableDOMError('Did not find some options');
progress.log(' did not find some options');
continue;
}
if (result === 'error:optionnotenabled') {
if (noAutoWaiting)
throw new NonRecoverableDOMError('Option being selected is not enabled');
progress.log(' option being selected is not enabled');
continue;
}
if (typeof result === 'object' && 'hitTargetDescription' in result) {
if (noAutoWaiting)
throw new NonRecoverableDOMError(`${result.hitTargetDescription} intercepts pointer events`);
progress.log(` ${result.hitTargetDescription} intercepts pointer events`);
continue;
}
if (typeof result === 'object' && 'missingState' in result) {
if (noAutoWaiting)
throw new NonRecoverableDOMError(`Element is not ${result.missingState}`);View on GitHub (pinned to c8fc3bf8d3)
Solutions
- Remove force:true so selectOption auto-waits until all requested options exist.
- Verify the options before selecting: assert locator.locator('option[value="x"]') is present.
- Correct the requested value/label to match an existing <option>.
- For async-loaded options, await the option's appearance first.
Example fix
// before
await page.locator('select').selectOption({ value: 'fr' }, { force: true }); // 'fr' missing → throws
// after
await page.locator('select').selectOption({ value: 'fr' }); // auto-waits for the option Defensive patterns
Strategy: retry
Validate before calling
// Wait for the option to exist, then select without force.
await page.locator(`option[value="${value}"]`).waitFor();
await page.locator('select').selectOption({ value }); Prevention
- Remove force:true on selectOption so it auto-waits for options.
- For async-loaded options, await the specific <option> first.
- Double-check requested values/labels against the actual option set.
When it happens
Trigger: Calling locator.selectOption({ value }) / selectOption({ label }) with force:true where one or more of the specified values/labels are not present among the <option> elements.
Common situations: Dynamic select whose options load asynchronously and the test used force before they arrived; typo in the option value; multi-select where some requested values are invalid.
Related errors
- Element is not visible
- Element is outside of the viewport
- Option being selected is not enabled
- ${result.hitTargetDescription} intercepts pointer events
- Element is not ${result.missingState}
AI-assisted analysis of microsoft/playwright@c8fc3bf8d3 (2026-08-12).
Data as JSON: /api/errors/fa316d8c49cff2b7.
Report an issue: GitHub.