Skip to content

[BUG] position of elements inside Chromium cross origin iframe seems wrong #3170

@joost2076

Description

@joost2076

Context:

  • Playwright Version: 1.2.1
  • Operating System: ubuntu 20.04
  • Node version: 10.19
  • Browser: Chromium

Code Snippet

<!-- running at localhost:8000 -->
<body>
    <div style="position:fixed;top:300px;left:300px;width:400px;height:400px;">
        <iframe src="https://en.wikipedia.org/"  width="100%" height="100%" > </iframe>    
    </div>
</body>
const playwright = require('playwright');

(async () => {
  const browser = await playwright.chromium.launch({headless:false });
  const context = await browser.newContext({viewport:{width:1920, height:1080}}); 
  const page = await context.newPage();

  await page.goto('http://localhost:8000');
  const frame = page.frames()[1]
  const button = await frame.$('#pt-login')
  await button.click()

  await browser.close();
})();

The bug
Chromium does not succeed in clicking the login button.
The position of elements inside a cross-origin iframe seem to be calculated without taking the offset of the iframe into account.
The offset of the iframe is set to top-left 300,300. Playwright tries to click 275.74, 37.18

checking that element receives pointer events at (275.74,37.18)

Serving some other content from localhost inside the iframe in chromium does take the offset into account and works as expected.
(Firefox works fine. Have not tried webkit)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions