Lesson 6: Handle Frames and Windows

Tabs & iFrames

Frames and Windows

Frames and Windows

1. iFrame Interaction

typescript

const myFrame = page.frame({ name: 'frame-id' });

await myFrame?.fill('#input', 'hello');

2. Multiple Pages

typescript

const pagePromise = context.waitForEvent('page');

await page.getByText('Open Tab').click();

const newPage = await pagePromise;

await newPage.waitForLoadState();

    CareerRaah - AI Learning Platform for Professionals