Test Automation & Frameworks interview questions.
Questions on Playwright, Selenium, Cypress, Page Object Model, test architecture, flaky tests, and framework design.
A test passes locally but fails in CI about one run in five. Walk me through what you check first, and why.
This single answer is scored on four dimensions: Technical accuracy · Coverage · Clarity · Best practices.
Free to start · 7-day trial on paid plans
How to approach automation questions.
Test automation interviews probe two things at once: can you write reliable code that exercises a real product, and can you reason about why the test suite has the shape it does. Reciting the test pyramid is not enough. Interviewers want to hear which decisions you made, which you regret, and what you would change if you owned the framework today.
Anchor every answer in a concrete framework. Playwright, Cypress, and Selenium each force different trade-offs: Playwright bakes auto-waiting and parallel context isolation into the runner, Cypress keeps you inside a single browser tab with a tight DX, and Selenium gives you raw WebDriver flexibility at the cost of having to assemble waits, retries, and reporting yourself. Saying "I would use a test automation framework" is a junior signal. Saying "I would reach for Playwright because we already isolate tests at the storage-state level" is the answer they want.
Locator strategy is the single most predictive topic. Interviewers will ask how you choose between data-testid, role selectors, CSS, and XPath, and they will keep asking until they find the layer where you stop having an opinion. A strong answer ranks selectors by stability: role-based first (because it co-evolves with accessibility), then data-testid (when role is ambiguous), then CSS (only as an escape hatch), with XPath reserved for legacy DOM you cannot annotate.
Flaky tests are the proxy for whether you have actually run a suite in CI. Be ready to walk through a real flake you debugged: what the symptom looked like in CI logs, how you isolated it (replay, video, trace viewer, network mock review), and the structural fix you eventually shipped. "I added a wait" is the wrong answer. "I removed the implicit wait, captured the network race in a Playwright trace, and replaced the unstable selector with a role query" is the right one.
What hiring managers are listening for
- Test architecture instinctsYou can defend why your suite is shaped like a pyramid, a trophy, or a honeycomb.
- Locator disciplineYou rank selector strategies by stability and explain when to break the rule.
- Flaky test ownershipYou debug to a structural fix instead of retry-until-green.
- Parallelisation literacyYou know how your framework isolates state, fixtures, and database access across workers.
Do not memorize the page object model definition and stop there. Interviewers ask follow-ups: when does POM become an anti-pattern, when do you replace it with the screenplay pattern or component objects, how do you handle drift when the UI moves faster than the page objects. If your POM answer is one paragraph long, you are not ready for senior automation rounds.
Need the vocabulary first? Browse all 27 Automation terms in the QA glossary.
Showing 35 questions · 10 free answers remaining
POM is a design pattern that creates an abstraction layer between test scripts and UI elements. Each page (or component) gets a class that encapsulates its locators and interactions. Benefits: reduces duplication (one locator update fixes all tests), improves readability (tests read like user stories), and makes maintenance scalable. Without POM, a single UI change can break dozens of tests.
Practice this question on its own pageTry a scored practice question, freeFirst, identify if flakiness is from timing (add explicit waits, not sleeps), test data (ensure isolation), or environment (container-based test infra). Track flaky tests with a quarantine mechanism, flag them, fix root causes, and only re-enable when stable. Implement retry logic as a temporary band-aid, not a permanent fix. Monitor flaky test rate as a team metric. In Playwright, use `test.retry()` judiciously and web-first assertions or `locator.waitFor()` over arbitrary delays.
Practice this question on its own pageTry a scored practice question, freePlaywright: best for modern web apps, auto-wait, multi-browser (Chromium, Firefox, WebKit), supports multiple languages, great for parallelism. Selenium: mature ecosystem, supports any language/browser, best when you need to integrate with legacy infrastructure or non-web testing. Cypress: excellent DX for JavaScript teams, time-travel debugging, but limited to Chromium-family browsers and single-tab testing. Choose based on team skills, browser requirements, and existing infrastructure.
Practice this question on its own pageTry a scored practice question, freeStart with goals: what types of tests (UI, API, visual), what browsers/platforms, what CI integration. Architecture layers: test runner (Playwright/Jest), page objects or component abstractions, test data management (factories/fixtures), reporting (Allure, HTML), and CI integration. Key decisions: parallel execution strategy, environment configuration, retry policies, and screenshot/video capture for failures. Start with a few critical path tests and expand. Avoid over-engineering, build what you need now.
Practice this question on its own pageTry a scored practice question, freeHard sleeps (`sleep(5000)`) waste time and are still flaky, avoid them. Implicit waits set a global timeout for element lookups but hide real problems. In Selenium, explicit waits (`WebDriverWait`) wait for a specific condition and are the right tool. In Playwright, prefer web-first assertions and locator actions, which auto-wait, so you rarely need manual waits. When a specific condition really needs waiting on, use `locator.waitFor()` or `page.waitForResponse()`, and avoid `networkidle`. Never wait a fixed time.
Practice this question on its own pageTry a scored practice question, freeApproaches by maturity: (1) Seed data in test setup, API calls or DB seeds before each test. (2) Factory pattern - generate unique data per test run to avoid conflicts. (3) Fixtures - Playwright fixtures provide scoped setup/teardown. (4) Isolated environments - Docker containers with known state. Key principle: each test should be independent and create its own data. Never rely on shared mutable state between tests.
Practice this question on its own pageTry a scored practice question, freeVisual regression captures screenshots of UI components or pages and compares them against approved baselines, pixel-by-pixel or perceptually. Tools: Playwright's `toHaveScreenshot()`, Percy, Chromatic, BackstopJS. Implementation: capture baselines in CI, compare on PR, review diffs in a visual dashboard. Challenges: dynamic content (mask timestamps, ads), responsive breakpoints (test multiple viewports), and managing baseline updates when UI intentionally changes.
Practice this question on its own pageTry a scored practice question, freeParallel execution reduces feedback time, a 60-minute suite can run in 10 minutes across 6 workers. Requirements: test isolation (no shared state or data), independent test environments or careful resource partitioning, and a runner that supports parallelism (Playwright shards, Selenium Grid, TestNG). Challenges: shared databases (use unique prefixes or separate schemas), file system conflicts, and port collisions. Monitor for flakiness introduced by parallelism.
Practice this question on its own pageTry a scored practice question, freeIntegrate axe-core via `@axe-core/playwright` or `cypress-axe`. Run automated a11y scans as part of your test suite, check for missing alt text, color contrast, ARIA roles, keyboard navigation. Automated tools catch ~30-40% of a11y issues (WCAG violations). Supplement with manual keyboard-only testing, screen reader testing (NVDA/VoiceOver), and user testing with people who use assistive technology.
Practice this question on its own pageTry a scored practice question, freeBDD uses natural-language scenarios (Given/When/Then) to describe expected behavior before writing code. Cucumber maps these Gherkin scenarios to step definitions (code). Benefits: shared language between QA, devs, and PMs; living documentation. Drawbacks: extra abstraction layer, step definition maintenance, and Gherkin can become a bottleneck if overused. Best for acceptance tests where non-technical stakeholders need to understand scenarios. Don't force all tests into BDD.
Practice this question on its own pageTry a scored practice question, freeAvoid logging in through the UI for every test, it's slow and fragile. Strategies: (1) API login - hit the auth endpoint, get a token, inject it. (2) Storage state - Playwright's `storageState` saves and reuses cookies/tokens across tests. (3) Bypass auth, use test-only auth shortcuts in lower environments. (4) Token factories - generate valid JWTs directly for test users. Always use dedicated test accounts with known credentials.
Practice this question on its own pageTry a scored practice question, freeRun core tests across Chromium, Firefox, and WebKit (Playwright handles all three natively). Use a matrix strategy in CI, parallel jobs per browser. Pitfalls: CSS rendering differences (especially flexbox/grid edge cases), Web API availability (e.g., some APIs lag in Safari/WebKit), and different JavaScript engine behaviors. Don't run every test cross-browser - focus on critical paths and UI-heavy flows. Use cloud grids (BrowserStack, LambdaTest) for real device coverage.
Practice this question on its own pageTry a scored practice question, freePriority order: (1) `data-testid` attributes, stable, decoupled from styling. (2) Accessible roles/labels, `getByRole("button", { name: "Submit" })`, good for a11y too. (3) Semantic HTML selectors - `form`, `nav`, `main`. Avoid: dynamic class names (CSS modules, Tailwind), XPath (brittle, hard to read), and positional selectors (nth-child). Work with developers to add test IDs during development - it's a 5-second change that saves hours of maintenance.
Practice this question on its own pageTry a scored practice question, freeThe pyramid suggests: many unit tests (fast, cheap), fewer integration tests, and few E2E/UI tests (slow, expensive). It's a useful heuristic but not absolute. Modern alternatives: the "testing trophy" emphasizes integration tests as the sweet spot. For QA-led automation, focus on where you add the most value, often API integration tests and critical E2E paths. The anti-pattern is an "ice cream cone", heavy E2E, few unit tests - which is slow and fragile.
Practice this question on its own pageTry a scored practice question, freeDynamic content: wait for the content to appear or stabilize with web-first assertions or `locator.waitFor()`. For infinite scroll, scroll programmatically and wait for new elements. Iframes: in Playwright, use `page.frameLocator("#iframe-id")` to scope interactions. In Selenium, switch to the iframe context with `driver.switchTo().frame()`. Always switch back to the main frame when done. For shadow DOM, use Playwright's `locator()` which pierces shadow DOM by default.
Practice this question on its own pageTry a scored practice question, freeLink automated test results to test cases in tools like TestRail, Zephyr, or Xray via their APIs. Typical flow: automation run completes → CI pipeline pushes results (pass/fail/skip per test case ID) → management tool updates status. Benefits: unified reporting for manual + automated tests, traceability to requirements, and historical trend data. Map test case IDs in annotations or test names. Don't over-invest in this unless your org requires formal test management.
Practice this question on its own pageTry a scored practice question, freeTest at three levels: (1) Service-level, contract tests (Pact) ensure services communicate correctly, unit/integration tests within each service. (2) Integration - API tests that verify end-to-end flows across services using test environments with all services deployed. (3) E2E - minimal UI tests for critical user journeys. Use consumer-driven contracts to catch integration breaks early. Service virtualization (WireMock) for isolated testing when dependencies are unavailable. Shift ownership: each team owns their service's tests.
Practice this question on its own pageTry a scored practice question, freeAutomate: high-frequency regression tests, smoke tests, data-driven tests, cross-browser checks. Keep manual: exploratory testing, usability evaluation, one-time verifications, tests requiring human judgment (visual appeal, UX flow). The ROI equation: if the test runs more than 3 times and the setup cost is less than the cumulative manual cost, automate it. Consider maintenance cost too, a flaky automated test can cost more than a manual one.
Practice this question on its own pageTry a scored practice question, freePOM separates page interactions (selectors, actions) from test logic. Each page or component gets its own class/object with methods like fillEmail(), clickSubmit(). Benefits: when a selector changes, you update one file instead of dozens of tests. It improves readability, tests read like user stories. It enables reuse, the same page object works across multiple test files. Without POM, selector changes cascade through every test file.
Practice this question on its own pageTry a scored practice question, freeNever use fixed sleeps. Use waits tied to conditions: prefer web-first assertions, and use locator.waitFor() or waitForResponse when needed. Playwright auto-waits on actions which handles most cases. For dynamic content: avoid networkidle, wait for specific API responses, use polling assertions (expect with timeout). For animations: wait for animation to complete or disable animations in test mode. The key principle: wait for the condition you need, not an arbitrary time.
Practice this question on its own pageTry a scored practice question, freeStrategies by maturity: (1) Hardcoded data in tests, simplest but fragile. (2) Factory functions that generate unique data per run (faker libraries). (3) API-based setup/teardown, create test data via API before tests, clean up after. (4) Database seeding, restore a known state before each test suite. (5) Isolated test environments per PR with their own database. Best practice: each test should create its own data and clean up, never depend on pre-existing state. Use unique identifiers (timestamps, UUIDs) to prevent collisions in parallel runs.
Practice this question on its own pageTry a scored practice question, freeMethods: (1) API-based auth, call the login endpoint directly, store the session token/cookie. (2) Playwright storageState, log in once, save browser state to a file, reuse across tests. (3) Mock auth, inject a valid JWT in test environment. (4) Service accounts with long-lived tokens for CI. Best practice: log in through UI in one dedicated auth test, use API/state reuse for all others. This saves minutes per test run.
Practice this question on its own pageTry a scored practice question, freeSystematic approach: (1) Track flaky tests with a quarantine system, flag but do not delete. (2) Analyze patterns, is it timing? Environment? Data? Concurrency? (3) Fix root causes: replace sleeps with explicit waits, isolate test data, stabilize test environments. (4) Auto-retry with reporting, retry once in CI but flag retried tests for investigation. (5) Set a flaky test budget, no more than 2% of suite should be flaky. (6) Weekly flaky test triage meetings. Never just re-run and hope.
Practice this question on its own pageTry a scored practice question, freeTools: Playwright visual comparisons, Percy, Chromatic, BackstopJS. When worth it: design-heavy applications, component libraries, marketing pages. Implementation: capture baseline screenshots, compare on each PR, review diffs in a dashboard. Challenges: handle dynamic content (dates, avatars) with masking, manage cross-browser/OS rendering differences, set appropriate diff thresholds. Not worth it for highly dynamic content like dashboards with live data.
Practice this question on its own pageTry a scored practice question, freeComponent tests sit between unit and e2e tests. They render a single component in isolation with its dependencies mocked, test interactions (click, type, select) and verify output. Tools: Playwright Component Testing, Cypress Component Testing, Testing Library. Benefits: faster than e2e, more realistic than unit tests, catch rendering bugs early. Use for: complex form components, interactive widgets, state-heavy components. Do not use for: simple presentational components or integration flows.
Practice this question on its own pageTry a scored practice question, freeApproaches: (1) Playwright sharding, split the suite across machines (separate CI jobs with `--shard`), while workers run tests in parallel inside each shard. (2) CI matrix strategy, run different test groups in parallel jobs. (3) Test splitting by time, use historical timing data to balance shards. (4) Isolated test data, each parallel worker uses its own test accounts/data. Key considerations: avoid shared state between parallel tests, use unique ports/databases per worker, collect and merge reports from all shards (blob reporter per shard, then `npx playwright merge-reports`). Typical speedup: 4x with 4 shards, diminishing returns beyond 8.
Practice this question on its own pageTry a scored practice question, freePlaywright: modern, fast, multi-browser (Chrome, Firefox, WebKit), auto-waits, built-in API testing, great for new projects. Selenium: mature, widest browser support, largest community, best for legacy projects or when you need Java/.NET support. Cypress: developer-friendly, great DX, real-time reloading, but supports Chrome-family browsers, Firefox and experimental WebKit, with no multi-tab support. Choose Playwright for new projects, Selenium for enterprises with existing investment, Cypress when developers will own the tests.
Practice this question on its own pageTry a scored practice question, freeUploads: Use setInputFiles() in Playwright or Cypress `.selectFile()`. For drag-drop uploads, dispatch the drop event programmatically. Downloads: In Playwright, use page.waitForEvent("download"), then verify the file content. In Cypress, intercept the download URL and verify with cy.readFile. Verify both success UI and actual file content. Handle edge cases: large files, wrong file types, multiple files, cancelled uploads.
Practice this question on its own pageTry a scored practice question, freeStructure: (1) Group by feature or domain, not by test type. (2) Shared fixtures and helpers in a common directory. (3) Page objects co-located with their tests or in a dedicated pages/ directory. (4) Config files per environment (dev, staging, prod). (5) Tagging system (@smoke, @regression, @critical) for selective execution. (6) Separate CI jobs for smoke (fast, every PR) vs full regression (nightly). (7) Clear naming conventions: describe blocks match feature areas, test names describe behavior.
Practice this question on its own pageTry a scored practice question, freeStrategy: (1) Run core tests on all target browsers (Chrome, Firefox, Safari/WebKit) in CI. (2) Use Playwright projects config to define browser matrix. (3) Responsive testing: use viewport sizes for mobile, tablet, desktop. (4) Device emulation for mobile-specific features (touch, geolocation). (5) Real device testing for critical flows via BrowserStack/Sauce Labs. (6) Prioritize browsers by user analytics data. Not every test needs every browser, focus cross-browser runs on critical paths.
Practice this question on its own pageTry a scored practice question, freePlaywright route.fulfill() or Cypress cy.intercept() lets you mock API responses. Mock when: testing error states (500, timeout), testing UI with specific data shapes, isolating frontend from backend instability, testing edge cases hard to reproduce. Do not mock for: integration tests verifying real API behavior, smoke tests, or when testing data persistence. Best practice: have both mocked and real API test suites, run mocked in PR CI and real in nightly.
Practice this question on its own pageTry a scored practice question, freeComponents: (1) Test results collection via reporter API (Playwright reporters, JUnit XML). (2) Storage in a database or dashboard tool (Allure, ReportPortal, custom DB). (3) Visualization: pass/fail trends, flaky test tracking, execution time trends, failure categories. (4) Alerting: Slack/email for failures, weekly summary reports. (5) Screenshots and traces attached to failures for debugging. Key: make failures actionable, not just visible. Link failed tests to JIRA tickets automatically.
Practice this question on its own pageTry a scored practice question, freeChallenges: timing, WebSocket connections, multiple users. Approach: (1) Use multiple browser contexts in Playwright to simulate sender and receiver. (2) Test WebSocket messages by intercepting them or checking UI updates. (3) Verify message ordering, delivery confirmation, and offline/reconnect scenarios. (4) Test rate limiting and scroll pagination. (5) Performance: measure time from send to display. Use web-first assertions or expect.poll for async assertions.
Practice this question on its own pageTry a scored practice question, freePriority order: (1) data-testid attributes, most stable, decoupled from styling. (2) ARIA roles and labels (getByRole, getByLabel), user-centric and accessible. (3) Text content (getByText), natural but fragile to copy changes. (4) CSS classes, avoid unless stable and semantic. (5) Never use: auto-generated IDs, position-based selectors (nth-child), deeply nested paths. Work with developers to add test attributes during development. The best selector is one that only changes when the feature changes.
Practice this question on its own pageTry a scored practice question, freePrinciples: (1) Monorepo or shared package for common utilities, page objects, and fixtures. (2) Clear contribution guidelines: PR templates, code review requirements, naming conventions. (3) Documentation: getting started guide, example tests, architecture decision records. (4) Governance: framework team owns core, product teams own their feature tests. (5) Shared CI infrastructure with team-specific test suites. (6) Automated linting and code quality checks on test code. (7) Regular office hours for framework support. The framework should be a product with its own backlog.
Practice this question on its own pageTry a scored practice question, freeStop reading answers. Start practicing them.
AssertHired's AI interviewer asks follow-up questions, scores your responses across 4 QA-specific dimensions, and gives you actionable feedback.
Answer a Free QuestionFree to start · 7-day trial on paid plans
More Question Categories
Explore questions across all QA interview topics.
Practice by Tool & Technology
Dive deeper with tool-specific interview questions.
Which comparisons and research cover Test Automation & Frameworks?
Original data and findings behind this topic.
Go deeper on test automation
Go beyond practice interviews - get the guides, drills, and frameworks that top QA engineers use.
Free QA career tools, no account needed
Instant and private, everything runs in your browser. Try them before you sign up.
QA Resume Checker
Instant 0-100 score on automation keywords, impact, and ATS formatting.
QA Cover Letter Generator
A tailored 3-paragraph QA cover letter from your resume and a job post.
QA Application Tracker
Drag-and-drop kanban to track every QA application from Applied to Offer.
QA Take-Home Test Generator
A realistic take-home assignment with a scenario, tasks, and a rubric.
QA LinkedIn Headline Generator
A recruiter-searchable headline, About section, and skills list.
QA STAR Story Builder
Structure a QA behavioral answer with the STAR method and instant checks.
QA Bug Report Generator
Build a clean, reproducible bug report for Markdown, Jira, or plain text.
Boundary Value Analysis Generator
Generate boundary value and equivalence partitioning test cases from a range.
QA Metrics Calculator
Calculate DRE, defect leakage, defect density, and pass rate with interpretation.
QA Test Plan Generator
Build a structured test plan (scope, approach, criteria, risks) in Markdown.
QA Salary Calculator
Estimate QA, SDET, and automation tester pay by level, market, and skills.
QA Offer Evaluator
See total comp, a counter range, and a ready-to-send negotiation message.
Ready to Ace Your QA Interview?
Stop reading answers, start practicing them live with AI that knows QA.
Join 700+ QA engineers already practicing with AssertHired.
A test passes locally but fails in CI about one run in five. Walk me through what you check first, and why.
This single answer is scored on four dimensions: Technical accuracy · Coverage · Clarity · Best practices.
Rather skip ahead? Create a free account