fix: stitch all frames into one snapshot (#49)

This commit is contained in:
Simon Knott 2025-03-27 17:20:58 +01:00 committed by GitHub
parent fb24561c67
commit 723a5420e6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 54 additions and 3 deletions

View file

@ -155,5 +155,13 @@ export const screenshot: Tool = {
};
function refLocator(page: playwright.Page, ref: string): playwright.Locator {
return page.locator(`aria-ref=${ref}`);
let frame = page.frames()[0];
const match = ref.match(/^f(\d+)(.*)/);
if (match) {
const frameIndex = parseInt(match[1], 10);
frame = page.frames()[frameIndex];
ref = match[2];
}
return frame.locator(`aria-ref=${ref}`);
}