frameLocator API// Locate elements directly inside an iframe:
const paymentFrame = page.frameLocator("#stripe-payment-frame");
await paymentFrame.getByLabel("Card Number").fill("4242 4242 4242 4242");// Multi-tabs:
const pagePromise = context.waitForEvent("page");
await page.getByRole("link", { name: "Open Terms" }).click();
const newPage = await pagePromise;
await expect(newPage).toHaveTitle(/Terms of Service/);
// Dialogs:
page.on("dialog", async (dialog) => {
await dialog.accept();
});