microsoft/playwright · error · Error
selectors.register: "${name}" selector engine has been alrea
Error message
selectors.register: "${name}" selector engine has been already registered What it means
Error "selectors.register: "${name}" selector engine has been already registered" thrown in microsoft/playwright.
Source
Thrown at packages/playwright-core/src/client/selectors.ts:33
*/
import { evaluationScript } from './clientHelper';
import { setTestIdAttribute } from './locator';
import { kNoTimeout } from './timeoutSettings';
import type { SelectorEngine } from './types';
import type * as api from '../../types/types';
import type * as channels from './channels';
import type { BrowserContext } from './browserContext';
export class Selectors implements api.Selectors {
private _selectorEngines: channels.SelectorEngine[] = [];
private _testIdAttributeName: string | undefined;
readonly _contextsForSelectors = new Set<BrowserContext>();
async register(name: string, script: string | (() => SelectorEngine) | { path?: string, content?: string }, options: { contentScript?: boolean } = {}): Promise<void> {
if (this._selectorEngines.some(engine => engine.name === name))
throw new Error(`selectors.register: "${name}" selector engine has been already registered`);
const source = await evaluationScript(script, undefined, false);
const selectorEngine: channels.SelectorEngine = { ...options, name, source };
for (const context of this._contextsForSelectors)
await context._channel.registerSelectorEngine({ selectorEngine }, kNoTimeout);
this._selectorEngines.push(selectorEngine);
}
setTestIdAttribute(attributeName: string) {
this._testIdAttributeName = attributeName;
setTestIdAttribute(attributeName);
for (const context of this._contextsForSelectors) {
context._options.testIdAttributeName = attributeName;
context._channel.setTestIdAttributeName({ testIdAttributeName: attributeName }, kNoTimeout).catch(() => {});
}
}
_withSelectorOptions<T>(options: T) {View on GitHub (pinned to c8fc3bf8d3)
When it happens
Trigger: Thrown at packages/playwright-core/src/client/selectors.ts:33 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of microsoft/playwright@c8fc3bf8d3 (2026-08-12).
Data as JSON: /api/errors/1d2c39828ba206e6.
Report an issue: GitHub.