Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Issues with iframes #33674

Open
karolwajs opened this issue Nov 19, 2024 · 4 comments
Open

[Bug]: Issues with iframes #33674

karolwajs opened this issue Nov 19, 2024 · 4 comments

Comments

@karolwajs
Copy link

karolwajs commented Nov 19, 2024

Version

1.49.0

Steps to reproduce

After upgrade to the newest chromium headless version my tests started to fail when i'm trying to access/make actions on some iframe elements, which isn't the case on the lower versions. I switched one of the click methods to dispatchEvent('click') and i see that this way it's working. I can't provide any specific example reproduction steps besides of mui date picker: https://mui.com/x/react-date-pickers/date-picker/, which is constantly failing in my case.

It's happening for very different locators, so i cannot provide any specific locator methods or actions, which will trigger this behaviour. I would be grateful for help, because that's the thing which is working for us on previous playwright and browser versions, it started to happen when we tried to switch to the newest one.

Channel: 'chromium'

Expected behavior

I expect iframes to work like in previous versions

Actual behavior

Error: Timed out 20000ms waiting for expect(locator).toBeVisible()

Locator: locator('.gldbm-panel__dbmIframe').contentFrame().getByTestId('extras')
Expected: visible
Received: <element(s) not found>
Call log:
  - expect.toBeVisible with timeout 20000ms
  - waiting for locator('.gldbm-panel__dbmIframe').contentFrame().getByTestId('extras')

Additional context

No response

Environment

System:
    OS: macOS 15.1
    CPU: (8) arm64 Apple M2
    Memory: 99.83 MB / 16.00 GB
  Binaries:
    Node: 20.12.1 - ~/.nvm/versions/node/v20.12.1/bin/node
    npm: 10.5.0 - ~/.nvm/versions/node/v20.12.1/bin/npm
  Languages:
    Bash: 3.2.57 - /bin/bash
  npmPackages:
    @playwright/test: ^1.49.0 => 1.49.0
@dgozman
Copy link
Contributor

dgozman commented Nov 19, 2024

@karolwajs Thank you for the issue! It seems like there is a difference in how new and old headless handle these iframes. However, it's unlikely we can fix the issue without a repro. Anything that shows the problem, even if not consistently, would be a great help.

@karolwajs
Copy link
Author

karolwajs commented Nov 19, 2024

If you click 'book now', the iframe will be opened (page.frameLocator('.gldbm-panel__dbmIframe')) with the booking engine, every interaction with a calendar (when it's displayed), clicking on dates for example won't be executed properly on v1.49.0 version

@dgozman
Copy link
Contributor

dgozman commented Nov 21, 2024

@karolwajs Unfortunately, clicking "Booking now" does not open any iframe for me. But even then, guessing the actions that do not work is not something that I'd like to do. Could you please record a short script on that page that does work without channel: 'chromium' and does not work with the channel specified?

@karolwajs
Copy link
Author

karolwajs commented Nov 22, 2024

'Book now', not 'Booking now'. Every action taken on the opened calendar is not working with channel 'chromium'
Image
Example script:

import date from 'date-and-time';
import { type FrameLocator, type Locator, type Page } from '@playwright/test';

test(
  'iFrame Test',
  async ({ page }) => {
    const startDate = new Date();
    const formattedStartDate = date.format(startDate, 'dddd, MMMM D, YYYY');
    await page.goto('https://gxpservicesstagestorage.z6.web.core.windows.net');
    await page.getByText('Book Now').click(); 
    await page.frameLocator('.gldbm-panel__dbmIframe').locator('#gldbm_startdate').click();
    await page.frameLocator('.gldbm-panel__dbmIframe').getByLabel(`Choose ${formattedStartDate} as your check-in date. It’s available.`).click();
 });

The last click won't be executed. (code will be executed, but the click won't happen).
It will work with .dispatchEvent('click')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants