PrepPilotPractise free

UI Automation (Playwright, Selenium) interview questions

Frameworks, locators, waits, flakiness, page objects

16 questions · locator · updated November 2026

Practise these as flashcards. One or two lines each; the ones you miss come back first.

Start free

Core questions

What are the main differences between Playwright, Selenium, and Cypress?

Playwright supports modern browser features and auto-waiting, Selenium is mature and language-agnostic, and Cypress is fast but mainly for Chrome-family browsers and JavaScript. Playwright and Cypress offer easier parallelization, while Selenium is more flexible with languages and browsers.

Why should you avoid using nth-child or dynamic class names in selectors?

Selectors like nth-child or dynamic classes are fragile because UI changes or updates can break them. Using stable attributes like IDs or accessible roles makes tests more reliable.

What is auto-waiting in Playwright?

Auto-waiting means Playwright automatically waits for elements to be ready before interacting, reducing the need for manual waits and making tests less flaky.

What is the Page Object Model?

The Page Object Model is a design pattern where each page or component is represented by a class or module, encapsulating elements and actions. This makes tests easier to maintain and reuse.

Intermediate questions

How do you handle flaky tests caused by timing issues?

I review the test logs to identify where timing issues occur, then add explicit waits or use auto-waiting features to ensure elements are ready. I also check for unstable selectors and improve them if needed.

How does Playwright's auto-waiting differ from Selenium's waits?

Playwright automatically waits for elements to be actionable, reducing manual waits. Selenium requires explicit waits, like WebDriverWait, for conditions such as visibility or clickability, making it more prone to flakiness if not handled carefully.

What are the benefits of using the Page Object Model?

POM improves code organization, reusability, and maintainability. It separates test logic from page structure, so changes to the UI only require updates in one place, not across all tests.

How do you ensure your tests are resilient to UI changes?

I use stable selectors like IDs, accessible roles, and data attributes. I avoid fragile selectors and regularly review them when the UI changes, updating page objects as needed.

How do you manage test data for parallel test runs?

I use unique test data for each parallel run, either by generating random values or using isolated fixtures. This prevents conflicts and ensures tests don't interfere with each other.

How do you integrate UI tests into CI pipelines?

I configure the CI tool, like GitHub Actions or Jenkins, to install dependencies and run tests on every code push. I set up reporting and notifications for failures to ensure fast feedback.

What is visual testing and how do you implement it?

Visual testing compares screenshots of the UI against baselines to catch layout or style regressions. I use tools like Playwright's toHaveScreenshot or integrate Percy for automated visual checks.

Senior questions

How would you design a cross-browser test suite using Playwright?

I'd configure Playwright's projects to target multiple browsers like Chromium, Firefox, and WebKit. Tests would run in parallel across these browsers, and I'd monitor for browser-specific failures, updating selectors or handling quirks as needed.

How do you debug flaky tests in CI that pass locally?

See the answer in the app, free

What are the trade-offs between Playwright and Selenium for large-scale automation?

See the answer in the app, free

How do you ensure reliable test execution at scale in CI/CD?

See the answer in the app, free

How do you handle dynamic elements that change frequently in the UI?

See the answer in the app, free

More Quality & Security topics