Home › Blog › Selenium interview questions with answer outlines

Selenium interview questions with answer outlines

Selenium interviews test whether you can build browser automation that is reliable and maintainable, not just record clicks. Expect questions on WebDriver architecture, locator strategies, implicit versus explicit waits, handling frames, windows and alerts, the page object model, framework design with a test runner, flaky tests, parallel execution with Selenium Grid and running suites in CI. A live task — automate a login and assert a result — is common.

Fifteen common Selenium interview questions

  1. How does Selenium WebDriver work?
  2. Which locator strategies do you prefer, and why?
  3. CSS selectors versus XPath?
  4. Implicit versus explicit versus fluent waits?
  5. Why shouldn't you use Thread.sleep?
  6. How do you handle frames, multiple windows and alerts?
  7. What is the page object model?
  8. How do you handle dynamic elements?
  9. What causes flaky tests, and how do you fix them?
  10. What is a StaleElementReferenceException?
  11. How do you run tests in parallel? What is Selenium Grid?
  12. How do you take screenshots on failure and report results?
  13. How do you manage test data?
  14. How do you integrate Selenium tests into CI?
  15. Selenium versus newer tools such as Playwright or Cypress?

Architecture and locators

Waits and flakiness

ApproachBehaviourVerdict
Thread.sleepAlways waits the full timeSlow and still flaky — avoid
Implicit waitGlobal wait for elements to appearSimple, but hides problems and mixes badly with explicit waits
Explicit waitWaits for a specific condition, such as clickablePreferred
Fluent waitExplicit wait with polling interval and ignored exceptionsFor unusual conditions

Flaky tests usually come from timing (acting before the page is ready), shared test data, dependence on test order, unstable locators or environment instability. Fix them with explicit waits on meaningful conditions, independent tests with their own data, stable locators and retries only as a last resort with tracking. StaleElementReferenceException means the element was re-rendered after you found it — locate it again after the page updates.

Framework design

The page object model represents each page or component as a class exposing user-level actions — login(user, password) — and hiding locators, so tests read like scenarios and a UI change requires updating one class. A good framework adds a test runner (JUnit, TestNG or pytest), configuration per environment, test data builders, screenshots and logs on failure, and readable reports. Keep assertions in tests, not page objects.

Scale and CI

A live task to rehearse

“Automate searching a product and adding it to the cart.” Create page objects for the search, results and cart pages; use explicit waits for the results list and the cart badge; assert on user-visible outcomes such as the item name and quantity in the cart; and clean up test data. Talk through how you'd run it in CI and what you'd do if it failed intermittently.

Practising

The fastest way to find gaps is to be asked. Run a spoken mock round on Selenium topics — a free AI interview assistant such as CoPilot Interview builds one from your résumé and the job description and scores every answer — then study whatever you stumbled on. Automate a login with a page object and an explicit wait, then explain how you'd stop it becoming flaky. See also QA engineer interview questions and manual testing interview questions.

Disclosure: CoPilot Interview is our product, so weigh what we say about it accordingly. Everything else on this page applies whichever tool you use, or none.

Frequently asked questions

What are common Selenium interview questions?

WebDriver architecture, locators, CSS versus XPath, waits, frames, windows and alerts, the page object model, dynamic elements, flaky tests, stale elements, Selenium Grid, reporting, test data and CI integration.

Implicit or explicit wait?

Explicit waits, which wait for a specific condition on a specific element. Implicit waits apply globally, hide timing problems and can combine unpredictably with explicit waits.

What is the page object model?

A design pattern where each page or component is a class exposing user actions and hiding locators, making tests readable and limiting changes when the UI changes.

How do you fix flaky Selenium tests?

Replace sleeps with explicit waits, make tests independent with their own data, use stable locators, stabilise the environment and investigate root causes rather than adding blind retries.

Practise on real interview questions

Run 145 real interview questions across 10 tracks, answer out loud and see a structured answer to compare with yours. Free, no signup.

Try a practice question