Playwright Interview Questions
Prepare for Playwright interviews with essential questions covering core concepts.
Q1: What is Playwright and why use it?
Answer: Playwright is a modern, open-source automation framework developed by Microsoft for testing web applications. It supports multiple browsers (Chromium, Firefox, WebKit) and provides features like auto-wait, network interception, and powerful debugging tools. It's faster and more reliable than traditional tools.
Q2: What is the difference between Playwright and Selenium?
Answer: Key differences include:
- Playwright has built-in auto-wait, reducing flaky tests
- Better support for modern web features like Shadow DOM
- Network interception and mocking capabilities
- Faster execution speed
- Better debugging tools and trace viewer
Q3: How do you handle multiple tabs in Playwright?
Answer: In Playwright, you can handle multiple tabs using context.waitForEvent('page') to capture new pages that open in tabs. Each tab is represented as a Page object, and you can switch between them easily.