diff --git a/playwriter/src/clean-html.ts b/playwriter/src/clean-html.ts index 62f8e30..cc4f6d4 100644 --- a/playwriter/src/clean-html.ts +++ b/playwriter/src/clean-html.ts @@ -26,9 +26,9 @@ function isRegExp(value: any): value is RegExp { function getSnapshotKey(locator: Locator | Page): string { if (isPage(locator)) { - return '__page__' + return 'page' } - return locator.selector() + return `locator:${locator.selector()}` } export async function getCleanHTML(options: GetCleanHTMLOptions): Promise { diff --git a/playwriter/src/executor.ts b/playwriter/src/executor.ts index 40ca75b..78067e3 100644 --- a/playwriter/src/executor.ts +++ b/playwriter/src/executor.ts @@ -790,7 +790,7 @@ export class PlaywrightExecutor { const shouldCacheSnapshot = !frame // Cache keyed by locator selector so full-page and locator-scoped snapshots // don't pollute each other's diff baselines - const snapshotKey = locator ? locator.selector() : '__page__' + const snapshotKey = locator ? `locator:${locator.selector()}` : 'page' let pageSnapshots = this.lastSnapshots.get(resolvedPage) if (!pageSnapshots) { pageSnapshots = new Map()