Skip to content

Working with iframes #2082

@ankur22

Description

@ankur22

What

Elements inside iframes are not accessible through the main page context, usually due to CORS restrictions.

Solution

Use locator.contentFrame() to access iframe content, e.g.:

await page.locator('#iframe').contentFrame().getByRole('button').click();

This requires the user to understand the website architecture or be able to work with the devtools window in their web browser.

In the future the hope is that they can work with k6 Studio which will be able to find suitable selectors and create the browser test script for them as they click through on their website.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions