microsoft/playwright · error · NonRecoverableDOMError

Option being selected is not enabled

Error message

Option being selected is not enabled

What it means

selectOption returned 'error:optionnotenabled': the targeted <option> exists but is disabled. With force:true or noAutoWaiting the loop cannot wait for it to become enabled, so it throws NonRecoverableDOMError('Option being selected is not enabled').

Source

Thrown at packages/playwright-core/src/server/dom.ts:360

          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}`);
        progress.log(`  element is not ${result.missingState}`);
        continue;
      }
      return result;
    }
  }

View on GitHub (pinned to c8fc3bf8d3)

Solutions

  1. Remove force:true so selectOption waits for the option to become enabled.
  2. Satisfy the precondition (fill dependent fields) that enables the option before selecting.
  3. If the option is permanently disabled, select a different, enabled option.

Example fix

// before
await page.locator('select').selectOption({ value: 'premium' }, { force: true }); // disabled → throws
// after
await page.locator('#accept-terms').check(); // enables the option
await page.locator('select').selectOption({ value: 'premium' });
Defensive patterns

Strategy: retry

Validate before calling

// Satisfy the precondition that enables the option, then select without force.
await page.locator('#accept-terms').check();
await page.locator('select').selectOption({ value: 'premium' });

Prevention

When it happens

Trigger: Calling selectOption with force:true on an option that carries the `disabled` attribute; selecting an option that is conditionally disabled until some precondition is met.

Common situations: Forms where certain options are disabled until prior fields are filled; the test skipped the precondition step and forced the select.

Related errors


AI-assisted analysis of microsoft/playwright@c8fc3bf8d3 (2026-08-12). Data as JSON: /api/errors/01b13413653cca65. Report an issue: GitHub.