From 3529278311dec035b86d7f7053439ed90ad1fef6 Mon Sep 17 00:00:00 2001 From: Devin Rousso Date: Wed, 24 Jun 2026 09:43:38 -0600 Subject: [PATCH] fix(webview): `page.getContentQuads` should work for elements inside ` + `); + const frame = page.frames()[1]; + const button = await frame.waitForSelector('button'); + const iframeBox = (await (await page.$('iframe')).boundingBox())!; + const inner = await button.evaluate(b => { const r = b.getBoundingClientRect(); return { x: r.left, y: r.top }; }); + const box = (await button.boundingBox())!; + expect(Math.round(box.x)).toBe(Math.round(iframeBox.x + inner.x)); + expect(Math.round(box.y)).toBe(Math.round(iframeBox.y + inner.y)); +}); + +it('should get bounding box of element inside a cross-origin iframe', async ({ page, server }) => { + await page.goto(server.EMPTY_PAGE); + await page.setContent(` +
+ + `); + const frame = page.frames()[1]; + const button = await frame.waitForSelector('button'); + const iframeBox = (await (await page.$('iframe')).boundingBox())!; + const inner = await button.evaluate(b => { const r = b.getBoundingClientRect(); return { x: r.left, y: r.top }; }); + const box = (await button.boundingBox())!; + expect(Math.round(box.x)).toBe(Math.round(iframeBox.x + inner.x)); + expect(Math.round(box.y)).toBe(Math.round(iframeBox.y + inner.y)); +}); + it('should force a layout', async ({ page, server }) => { await page.setViewportSize({ width: 500, height: 500 }); await page.setContent('
hello
');