Learn how to handle multiple windows and tabs in Playwright using TypeScript! 🚀 In this video, we explain the difference between multiple windows and multiple tabs and how to interact with them using Playwright.
🔥 Topics Covered:
✅ What is the difference between a new window and a new tab?
✅ How to handle popups and new tabs in Playwright
✅ Playwright syntax for handling multiple windows and tabs
📝 Playwright Syntax:
👉 Handling a new tab (Popup Event in Playwright):
const [newTab] = await Promise.all([
page.waitForEvent("popup"),
page.click("locator")
]);
await newTab.waitForLoadState();
👉 Handling a new window (New Context Page):
const [newWindow] = await Promise.all([
context.waitForEvent("page"),
page.click("locator")
]);
await newWindow.waitForLoadState();
🔄 Difference Between Multiple Windows & Tabs:
✔ New Tab: Opens within the same browser context (shares cookies, storage, and session).
✔ New Window: Opens in a separate browser context (isolated session, no shared storage).
🚀 Subscribe for more Playwright tutorials! 🔔 Don't forget to like, share, and comment if you found this video helpful!
#Playwright #AutomationTesting #QA #TypeScript #MultipleWindows #MultipleTabs #WebAutomation