Blog # 19 ๐ "Oops, It Opened in a New Tab!" — Handling Multiple Windows in Playwright Like a Pro:
Ever clicked a link in a web app and suddenly you're in a new tab or window? That exact moment is where most automation tests go, “Wait, where did my browser go?” Well, not anymore. ๐ Today, I’m going to walk you through how to handle multiple tabs/windows using Playwright and yes, it’s way easier than you think! ๐งช The Real-Life Scenario While playing around with OrangeHRM's demo site(https://opensource-demo.orangehrmlive.com/), I noticed something interesting: There’s a link on the login page that says " OrangeHRM Website " — and when you click it… boom! New tab opens with the company's homepage. Perfect use case to try out multiple window handling in Playwright! ๐ง ๐ Warm-up: Managing Multiple Pages Manually First, let’s create two separate tabs and visit two different pages. Simple but useful! test ( 'Handle pages like a multitasking pro' , async () => { const browser = await chromium. launch (); const context = await browser. newCo...