Top Selenium & Playwright Interview Questions (2026 Edition): The Complete Guide to Cracking Web Automation, SDET & QA Automation Interviews
Top Selenium & Playwright Interview Questions (2026 Edition)
The Complete Guide to Cracking Web Automation, SDET & QA Automation Interviews
Introduction
Web automation remains one of the most important skills for SDET, QA Automation Engineer, Software Test Engineer, and Quality Engineer roles.
Among the most widely discussed automation technologies are Selenium and Playwright. Selenium WebDriver provides a browser automation API that drives browsers natively, locally or through a remote Selenium server. (Selenium) Playwright, meanwhile, combines browser automation with features such as built-in locators, auto-waiting, isolated browser contexts, fixtures, and web-first assertions. (Playwright)
For interview candidates, simply knowing commands isn't enough. Companies increasingly assess whether you can:
Design maintainable automation frameworks
Select reliable locators
Handle synchronization correctly
Automate dynamic web applications
Test APIs and databases
Run tests in parallel
Integrate automation into CI/CD
Diagnose flaky tests
Design scalable test architecture
Explain Selenium and Playwright trade-offs
This guide covers the most important Selenium and Playwright interview questions, from beginner to advanced level.
1. Selenium Interview Questions
Q1. What is Selenium?
Answer:
Selenium is an open-source browser automation ecosystem commonly used to automate web applications.
Its WebDriver component provides a programming interface for controlling browsers. WebDriver can drive browsers locally or remotely through Selenium infrastructure. (Selenium)
Key Selenium components
Selenium WebDriver
Selenium Grid
Selenium IDE
For modern SDET interviews, WebDriver is usually the most important component.
Q2. What is Selenium WebDriver?
WebDriver is the API used to interact programmatically with a browser.
It can perform operations such as:
Open a URL
Find elements
Enter text
Click buttons
Select options
Handle windows
Work with frames
Execute browser actions
A good interview answer should also mention that WebDriver is designed as a relatively compact, object-oriented browser automation API. (Selenium)
Q3. What is the difference between Selenium IDE, WebDriver and Grid?
| Component | Purpose |
|---|---|
| Selenium IDE | Record/playback and lightweight automation |
| Selenium WebDriver | Programmatic browser automation |
| Selenium Grid | Remote and parallel browser execution |
For enterprise automation, WebDriver combined with a test framework and Grid or another execution infrastructure is commonly more relevant than IDE.
Q4. What are Selenium locators?
Locators identify elements in the DOM.
Common approaches include:
ID
Name
Class Name
Tag Name
Link Text
Partial Link Text
CSS Selector
XPath
Interview Tip
Don't say that XPath is always the best locator.
A better answer is:
I prefer stable, meaningful attributes such as IDs or dedicated test attributes where available. I use CSS or XPath when necessary, particularly for complex relationships.
Q5. XPath vs CSS Selector: Which Is Better?
There is no universal winner.
CSS
Advantages:
Concise
Familiar to web developers
Good for many element-selection scenarios
XPath
Advantages:
Can navigate relationships in the DOM
Useful for certain complex element structures
Supports text-based and hierarchical expressions
The key interview point is locator stability, not simply choosing XPath or CSS.
Q6. What is the difference between absolute and relative XPath?
Absolute XPath
Starts from the root of the document.
Example:
/html/body/div[2]/div/form/inputIt is usually fragile because changes to the DOM hierarchy can break it.
Relative XPath
Starts from a meaningful element or condition.
Example:
//input[@name='email']Relative XPath is generally easier to maintain.
Q7. What is synchronization in Selenium?
Synchronization ensures that automation interacts with the application at an appropriate time.
Modern applications frequently load elements asynchronously, so blindly executing actions immediately can cause failures.
Common Selenium waiting approaches include:
Implicit wait
Explicit wait
Fluent wait
Q8. Implicit Wait vs Explicit Wait
Implicit Wait
Applies a default waiting behavior when locating elements.
Explicit Wait
Waits for a specific condition.
For example:
Wait until element is visible
Wait until element is clickable
Wait until URL changes
Wait until a particular condition becomes trueInterview Answer
I generally prefer explicit, condition-based synchronization because it makes the intent of the test clearer and avoids unnecessarily waiting for unrelated elements.
Selenium 4 uses Duration in its modern Java timeout APIs. (Selenium)
Q9. What is Fluent Wait?
Fluent Wait provides configurable polling and timeout behavior.
It can be useful when:
An element takes unpredictable time to appear
You need customized polling
Certain exceptions should be ignored during waiting
Q10. How do you handle dynamic elements?
Possible strategies include:
Stable attributes
Relative XPath
CSS selectors
Explicit waits
Parent-child relationships
Partial attribute matching
Dedicated test IDs
Avoid relying on randomly generated IDs whenever possible.
Q11. How do you handle iframes?
First identify the frame and switch the driver's context to it.
After completing the interaction, switch back to the default document.
Conceptually:
Default Page
↓
Switch to Frame
↓
Interact with Elements
↓
Switch to Default ContentA common interview follow-up is:
What happens if you try to interact with an element inside a frame without switching to that frame?
The element generally won't be accessible from the current document context.
Q12. How do you handle multiple browser windows or tabs?
The general approach is:
Capture the available window handles.
Identify the target window.
Switch the driver to that window.
Perform the required actions.
Switch back if necessary.
Q13. What is Page Object Model?
Page Object Model (POM) is a design pattern used to separate page-specific interaction logic from test logic.
For example:
LoginTest
↓
LoginPage
↓
Locators + Page ActionsThe Selenium documentation describes Page Objects as a way to reduce duplicated code and centralize knowledge about page structure, making UI changes easier to maintain. (Selenium)
Q14. Should assertions be placed inside Page Objects?
Generally, tests should own test assertions, while Page Objects should expose the operations or information needed by tests.
Selenium's Page Object guidance specifically recommends keeping test verification in the test rather than putting general assertions inside page objects, with limited exceptions for verifying that a page is correctly loaded. (Selenium)
This is an excellent topic for senior SDET interviews.
Q15. What is a Selenium automation framework?
A framework is a structured architecture that organizes:
Tests
Page Objects
Utilities
Configuration
Test data
Reporting
Logging
Drivers
CI/CD
Parallel execution
A scalable framework should make tests reusable, maintainable, readable, and diagnosable.
2. Playwright Interview Questions
Q16. What is Playwright?
Playwright is a browser automation and testing framework designed for modern web applications.
It provides:
Browser automation
Locators
Assertions
Browser contexts
Test fixtures
Parallel execution capabilities
API testing capabilities
Debugging and reporting features
Playwright supports Chromium, Firefox, and WebKit through its browser automation ecosystem. (Playwright)
Q17. What makes Playwright different from Selenium?
A strong interview answer should avoid saying that one tool simply "replaces" the other.
Instead, explain the architectural and workflow differences.
Selenium
Mature WebDriver ecosystem
Broad language support
Strong remote execution ecosystem
Extensive existing enterprise adoption
Selenium Grid for distributed execution
Playwright
Built-in modern browser automation features
Strong locator model
Auto-waiting/actionability checks
Browser contexts
Test fixtures
Web-first assertions
Integrated debugging and testing workflow
Playwright automatically performs actionability checks before actions such as clicks. (Playwright)
Q18. What are Playwright locators?
Locators are Playwright's recommended mechanism for finding elements.
Examples include:
getByRole()
getByText()
getByLabel()
getByPlaceholder()
getByAltText()
getByTestId()Playwright recommends prioritizing user-facing attributes and explicit testing contracts instead of fragile DOM-dependent selectors. (Playwright)
Q19. Why are Playwright locators considered powerful?
Playwright locators are designed around auto-waiting and retryability.
When an action is performed, Playwright checks whether the target is actionable rather than blindly interacting with the element.
For example, before a click, Playwright checks conditions such as:
Element resolves correctly
Visible
Stable
Receives events
Enabled
This can reduce synchronization-related test failures.
Q20. What is Playwright auto-waiting?
Auto-waiting means Playwright waits for the required actionability conditions before performing an action.
For example:
Find button
↓
Is it visible?
↓
Is it stable?
↓
Can it receive events?
↓
Is it enabled?
↓
ClickThis is one of the most important differences to understand when comparing Playwright with traditional Selenium synchronization strategies.
Q21. Should you use waitForTimeout() everywhere in Playwright?
No.
Hard-coded sleeps are generally a poor synchronization strategy.
Prefer:
Locator-based actions
Web-first assertions
Explicit conditions where necessary
Appropriate navigation/wait APIs
Playwright's documentation emphasizes automatic waiting and assertions designed to wait for expected states. (Playwright)
Q22. What are Browser, BrowserContext and Page in Playwright?
Think of them as three levels:
Browser
↓
BrowserContext
↓
PageBrowser
Represents the browser process.
BrowserContext
Provides an isolated browser session.
Page
Represents a browser tab/page.
Playwright's test fixtures provide isolated contexts and pages for tests, helping prevent tests from interfering with each other. (Playwright)
Q23. What is a BrowserContext?
A BrowserContext is an isolated browser environment.
It is particularly useful for:
Test isolation
Multiple users
Authentication scenarios
Parallel testing
Independent sessions
For example, you can create separate contexts for:
Admin User
Customer User
Guest Userwithout requiring separate browser processes for each scenario.
Q24. What are Playwright fixtures?
Fixtures establish the environment needed by tests.
Playwright Test provides built-in fixtures such as:
pagecontextbrowserrequest
Fixtures can also be customized for reusable setup and teardown logic. (Playwright)
Q25. What is test isolation in Playwright?
Playwright Test uses isolated browser contexts so that tests can operate independently.
This helps prevent:
Shared cookies
Shared local storage
Authentication leakage
Test-order dependency
Good test isolation is an important factor in building reliable automation suites. (Playwright)
Q26. How do you handle authentication in Playwright?
Common approaches include:
Login through the UI
API-based authentication
Reusing authenticated browser state
Creating separate contexts for different users
For large suites, avoiding repeated UI login where appropriate can significantly reduce execution time.
Q27. How do you handle popups in Playwright?
Playwright provides event-based mechanisms for handling new pages and popup windows.
The key idea is to coordinate the expected popup with the action that triggers it rather than attempting to find it after the fact.
Q28. How do you handle iframes in Playwright?
Playwright provides FrameLocator for interacting with elements inside frames.
For example:
Page
↓
FrameLocator
↓
Element Locator
↓
ActionThis can make frame interactions more readable than manually managing browsing contexts.
Q29. What are web-first assertions?
Playwright assertions are designed around eventual states.
For example:
Expect element to be visible
Expect URL to contain value
Expect title to match
Expect element to contain textThis is preferable to immediately checking a value that may not have reached the expected state yet. Playwright documents these assertions as part of its approach to reducing race conditions and flaky timeouts. (Playwright)
Q30. How do you handle flaky tests in Playwright?
Start by identifying the cause rather than simply increasing timeouts.
Investigate:
Weak locators
Race conditions
Shared state
External dependencies
Network instability
Test-order dependency
Incorrect synchronization
Then improve:
Locator strategy
Test isolation
Fixtures
Assertions
Test data
Mocking/stubbing where appropriate
3. Selenium vs Playwright Interview Questions
Q31. Selenium vs Playwright: Which Should You Choose?
The correct answer is:
It depends on the application, team, ecosystem, existing framework, browser requirements, and organizational constraints.
Consider:
Choose Selenium when:
The organization already has a mature Selenium ecosystem.
Broad language support is important.
Existing Selenium/Grid infrastructure is significant.
You need compatibility with established enterprise tooling.
Consider Playwright when:
You are building a modern web automation stack.
Built-in auto-waiting is valuable.
You want integrated test fixtures and browser contexts.
You want modern locator and debugging capabilities.
Q32. What is the biggest synchronization difference?
Selenium
You commonly manage explicit synchronization through wait strategies.
Playwright
Many common interactions automatically wait for the target to become actionable.
This does not mean Playwright never requires explicit waiting logic. It means synchronization is more deeply integrated into its locator/action model. (Playwright)
Q33. Selenium vs Playwright for parallel testing?
Both ecosystems support parallel/distributed execution, but the implementation approach differs.
When answering an interview question, discuss:
Test isolation
Browser instances
Browser contexts
Worker processes
Infrastructure
Resource utilization
CI/CD architecture
Avoid simply saying:
"Playwright is faster."
Performance depends heavily on test design, environment, browser configuration, network conditions, and infrastructure.
Q34. Which tool is better for modern web applications?
Again, avoid an absolute answer.
Playwright provides several capabilities designed for modern web testing, including locators with auto-waiting, browser contexts, fixtures, and web-first assertions. (Playwright)
Selenium remains highly relevant because of its mature WebDriver ecosystem and broad adoption.
The best choice should be based on the project's requirements.
4. Advanced SDET Interview Questions
Q35. How would you design a scalable automation framework?
A strong answer should cover:
Test Layer
↓
Page / Component Layer
↓
API Layer
↓
Utility Layer
↓
Data Layer
↓
Configuration
↓
Reporting & Logging
↓
CI/CDAlso discuss:
Parallel execution
Test isolation
Retry strategy
Environment management
Secrets management
Test data
Reporting
Observability
Failure analysis
Q36. How would you reduce flaky tests?
Use a systematic approach:
1. Identify the Failure Pattern
Is it:
Timing?
Network?
Locator?
Environment?
Data?
Dependency?
2. Improve Synchronization
Use meaningful conditions instead of arbitrary delays.
3. Improve Locators
Prefer stable contracts.
4. Improve Isolation
Avoid shared state.
5. Improve Test Data
Create deterministic data.
6. Investigate Infrastructure
Check browser, environment, network, and service dependencies.
Q37. How would you run 10,000 automated tests efficiently?
Discuss:
Parallel execution
Test sharding
Distributed workers
Browser/container infrastructure
Test categorization
Smoke/regression suites
Intelligent test selection
CI/CD orchestration
Artifact storage
Reporting
The objective isn't simply to run everything simultaneously. It is to maximize useful execution while controlling infrastructure cost and preserving reliability.
Q38. How would you design automation for a microservices application?
Consider multiple layers:
Unit Tests
↓
API Tests
↓
Contract Tests
↓
Integration Tests
↓
UI Tests
↓
End-to-End TestsThe goal should not be to push every scenario through the UI.
A strong automation strategy places tests at the lowest appropriate layer.
Q39. How do you decide what to automate?
Prioritize scenarios that are:
Frequently executed
Stable
Business-critical
Time-consuming manually
Regression-heavy
Data-intensive
High risk
Avoid automating everything simply because automation is possible.
Q40. How do you integrate Selenium or Playwright into CI/CD?
A typical pipeline can look like:
Developer Commit
↓
Build
↓
Unit Tests
↓
API Tests
↓
UI Automation
↓
Test Reports
↓
Quality Gate
↓
DeploymentAlso discuss:
Parallel workers
Browser/container images
Secrets
Test artifacts
Screenshots
Videos/traces
Failure notifications
5. Scenario-Based Interview Questions
These questions are particularly valuable because they test practical experience.
Scenario 1
The login button sometimes fails because the page is still loading. What would you do?
Don't immediately add:
sleep(10)Instead investigate:
Locator stability
Element state
Page readiness
Network dependency
Appropriate synchronization
Scenario 2
Your test passes locally but fails in CI. What do you investigate?
Check:
Browser version
Environment configuration
Timing
Network
Test data
Headless behavior
Resource constraints
Parallel execution
Dependency versions
Scenario 3
Your regression suite takes five hours. How would you reduce it?
Consider:
Parallelization
Test prioritization
Removing redundant tests
API-level testing
Better test data setup
Faster authentication
Test sharding
Infrastructure optimization
Scenario 4
A developer changes the UI and 200 tests fail. How would you prevent this?
Use:
Page Objects
Component Objects
Stable locators
Centralized UI interaction logic
Better test architecture
Selenium's documentation specifically highlights the maintainability benefits of Page Objects when UI changes occur. (Selenium)
6. Top 20 Rapid-Fire Interview Questions
Before your interview, make sure you can answer these quickly:
What is Selenium WebDriver?
What is Playwright?
Selenium vs Playwright?
What are Selenium locators?
XPath vs CSS?
Implicit vs explicit wait?
What is Page Object Model?
What is a flaky test?
How do you handle iframes?
How do you handle multiple windows?
What is Playwright auto-waiting?
What are Playwright locators?
What is BrowserContext?
What are Playwright fixtures?
What is test isolation?
How do you handle authentication?
How do you run tests in parallel?
How do you integrate automation with CI/CD?
How do you design a scalable automation framework?
How do you reduce flaky tests?
7. Practical Projects for Interview Preparation
Project 1: E-Commerce Automation
Automate:
Login
Product search
Product filtering
Cart
Checkout
Logout
Project 2: API + UI Automation
Build a framework combining:
UI + API + Database
Validate that an action performed through the UI produces the expected API and database state.
Project 3: Cross-Browser Automation
Run tests across:
Chromium/Chrome
Firefox
WebKit/Safari-equivalent coverage where supported
Project 4: CI/CD Automation
Connect your framework to:
Git
Jenkins or GitHub Actions
Automated test execution
HTML reports
Screenshots/artifacts
Project 5: Enterprise Automation Framework
Include:
Page/Component Objects
API testing
Database validation
Parallel execution
Logging
Reporting
Configuration
CI/CD
Docker
This is particularly useful for senior SDET candidates.
8. How to Prepare in 90 Days
Days 1–30: Selenium Fundamentals
Focus on:
WebDriver
Locators
XPath
CSS
Waits
Windows
Frames
Alerts
Actions
POM
Days 31–60: Playwright + Modern Automation
Learn:
Locators
Auto-waiting
Assertions
BrowserContext
Fixtures
API testing
Parallel execution
Debugging
Test reports
Playwright's current documentation emphasizes locators, fixtures, isolated contexts, and web-first testing practices. (Playwright)
Days 61–90: Advanced Interview Preparation
Practice:
Framework design
CI/CD
Docker
SQL
API testing
System design
Flaky test diagnosis
Coding
Mock interviews
9. Resume Tips for Selenium & Playwright Roles
Don't simply list:
Selenium, Playwright, Java, Python, Jenkins.
Instead demonstrate impact.
Weak
Created Selenium automation scripts.
Strong
Designed a reusable Selenium automation framework with Page Objects, parallel execution and CI/CD integration, significantly reducing regression execution effort.
Playwright Example
Developed a Playwright-based end-to-end test suite using resilient locators, isolated test contexts and reusable fixtures for scalable CI execution.
The second approach communicates engineering capability rather than tool familiarity.
10. Final Interview Checklist
Selenium
☑ WebDriver
☑ Locators
☑ XPath
☑ CSS
☑ Waits
☑ Frames
☑ Windows
☑ Actions
☑ POM
☑ Grid
Playwright
☑ Locators
☑ Auto-waiting
☑ Assertions
☑ Browser
☑ BrowserContext
☑ Page
☑ Fixtures
☑ API testing
☑ Parallel execution
☑ Debugging
SDET
☑ Programming
☑ SQL
☑ API testing
☑ Git
☑ CI/CD
☑ Docker
☑ Framework design
☑ Test architecture
☑ Performance testing
☑ System design
Final Thoughts
Selenium and Playwright interviews are increasingly testing engineering judgment rather than tool memorization.
A candidate who can explain how to choose stable locators, synchronize reliably, structure Page Objects, isolate tests, design reusable fixtures, integrate API and UI testing, run tests efficiently in CI/CD, and diagnose flaky failures will stand out from someone who only knows individual commands.
Selenium remains an important WebDriver-based automation technology with a mature ecosystem, while Playwright offers a modern testing model built around locators, auto-waiting, browser contexts, fixtures, and web-first assertions. (Selenium)
The most effective preparation strategy is therefore:
Learn the tool → Understand the underlying concept → Build a framework → Automate a real application → Integrate CI/CD → Practice debugging → Explain your design decisions.
Your Selenium & Playwright Interview Success Formula
Programming + Testing Fundamentals + Selenium + Playwright + API Testing + SQL + Framework Design + CI/CD + Debugging + System Design + Mock Interviews = SDET Interview Success
Career Education for Success
Discover • Apply • Succeed
Don't just learn automation tools. Learn to engineer quality.
Comments
Post a Comment
"Thank you for seeking advice on your career journey! Our team is dedicated to providing personalized guidance on education and success. Please share your specific questions or concerns, and we'll assist you in navigating the path to a fulfilling and successful career."