30 Selenium interview questions to ask and what strong answers sound like
30 Selenium interview questions by skill level, with strong-answer notes, red flags and a scorecard for hiring QA automation engineers.

Selenium still runs the automated browser tests behind most web QA teams, so hiring a Selenium automation engineer means checking real skill with locators, waits, the Page Object Model and CI, not just memorized trivia. These 30 Selenium interview questions are grouped from basic to advanced, with what a strong answer covers and the red flags that show a candidate has only read a cheat sheet.
TL;DR / Key takeaways
- Selenium interview questions should move from WebDriver basics to locator strategy, waits, the Page Object Model, and finish with a scenario or debugging task.
- A strong candidate explains why a choice works, not just what the API call is: for example, why an explicit wait beats
Thread.sleep(), not just the syntax. - The most common red flag is a candidate who can name Selenium commands but cannot explain flaky tests, stale element exceptions or how to structure a framework.
- Pair the interview with a short hands-on task: fixing a flaky locator or writing one test method tells you more than any verbal answer.
- Score each answer 1 to 5 against a simple rubric (below) so interviewers compare candidates on the same scale.
Basic Selenium interview questions
Basic questions check whether a candidate actually understands WebDriver, locators and waits, not just whether they can repeat definitions.
- What is Selenium, and what are its main components? A strong answer names Selenium WebDriver (browser automation API), Selenium IDE (record-and-playback for quick scripts), and Selenium Grid (running tests across machines and browsers in parallel), and explains that WebDriver is what most real test suites use day to day.
- How does Selenium WebDriver talk to the browser? Look for an answer that mentions the WebDriver protocol (a W3C standard, as MDN Web Docs documents it): the test script sends commands to a driver executable, which translates them into native browser calls, rather than WebDriver controlling the browser's internals directly.
- What locator strategies does Selenium support, and which do you prefer? A candidate should list ID, name, class name, tag name, link text, CSS selector and XPath, and explain that ID and CSS selectors are usually faster and more stable than XPath, which they reserve for cases CSS cannot handle.
- What is the difference between
findElement()andfindElements()?findElement()returns the first match and throwsNoSuchElementExceptionif nothing matches;findElements()returns a list, which is empty (not an exception) if nothing matches. - What is a
StaleElementReferenceException, and when does it happen? A strong answer connects this to the DOM changing after the element was located (a page refresh, a re-render, a dynamic update), so the original reference no longer points to a live element, and explains that re-locating the element fixes it. - How do you handle a dropdown in Selenium? Expect the
Selectclass:selectByVisibleText(),selectByValue()orselectByIndex()for standard HTML<select>elements, and a note that custom JavaScript dropdowns need different handling (clicks and visible-text checks) because they are not real<select>tags. - How do you take a screenshot in Selenium? The
TakesScreenshotinterface andgetScreenshotAs()method; a stronger answer adds that teams usually automate this on test failure for debugging, not on every step. - How do you handle browser cookies in Selenium?
manage().getCookies(),addCookie()anddeleteAllCookies(); a good candidate gives an example use case, such as skipping a login flow by injecting a session cookie.

Intermediate Selenium interview questions
Intermediate questions test whether a candidate can write tests that survive a real, changing application, not just a static demo page.
- What is the difference between implicit and explicit waits? An implicit wait applies a single polling timeout to every
findElement()call for the whole driver session; an explicit wait (WebDriverWaitwithExpectedConditions) waits for a specific condition on a specific element. A strong candidate adds that mixing both can cause unpredictable wait times and that most teams pick one approach. - Why is
Thread.sleep()considered bad practice in Selenium tests? It waits a fixed time regardless of whether the page is ready, which makes tests slower than necessary when the page loads fast and still flaky when it loads slow; explicit waits adjust to the actual condition. - What is the Page Object Model (POM), and why use it? POM represents each page or component as a class, with its locators and actions as methods, so a UI change means updating one class instead of every test that touches that page. Expect a mention that this is the standard way to keep a test suite maintainable as it grows.
- How do you handle a multi-window or multi-tab scenario?
getWindowHandles()to list open windows andswitchTo().window(handle)to move between them; a strong candidate notes that a new handle only appears after the window has actually opened, so a wait or retry is often needed. - How do you handle an iframe in Selenium?
switchTo().frame()by index, name, orWebElement, andswitchTo().defaultContent()to return to the main page; a common mistake candidates should flag is forgetting to switch back out of the frame before interacting with elements outside it. - How do you handle an alert or confirmation popup?
switchTo().alert(), thenaccept(),dismiss(), orgetText(); note that Selenium cannot handle OS-level or browser-native dialogs such as file upload windows the same way, which is a common follow-up trap. - What is the difference between
close()andquit()?close()closes the current browser window or tab;quit()closes every window the driver opened and ends the session, releasing resources. Forgettingquit()is a common source of leaked browser processes in CI. - How do you run Selenium tests in headless mode, and why would you? Setting the browser's headless option (for example
ChromeOptions().addArguments("--headless=new")); headless runs are faster and lighter on CI infrastructure, though a candidate should note that a few rendering or screenshot-dependent tests may still need a real browser. - How do you parameterize or data-drive a Selenium test? With a test framework's data provider (TestNG
@DataProvider, JUnit 5@ParameterizedTest, or pytest fixtures/parametrize), reading inputs from a CSV, Excel file, or database rather than hardcoding values.
Advanced Selenium interview questions
Advanced questions separate candidates who can build and run a framework from those who can only write individual test scripts.
- How do you make Selenium wait for an AJAX call or a dynamically loaded element? Explicit waits with a specific
ExpectedConditionsmatch (visibility, clickability, text presence) tied to the element that only appears once the AJAX call resolves, rather than a wait on the whole page load. - How would you design a Selenium framework from scratch? Look for a layered answer: a base/driver layer (browser setup and teardown), a page object layer, a test layer, a reporting layer (such as Allure or ExtentReports), and a config layer for environment and browser settings, wired together with a build tool (Maven or Gradle) and a CI pipeline.
- How do you integrate Selenium with a CI/CD pipeline? Running the suite from Jenkins, GitHub Actions, or GitLab CI on each pull request or merge, usually against a Selenium Grid or a cloud grid for parallel, cross-browser runs, with failures gating the build or flagged for review.
- What is Selenium Grid, and when do you need it? A hub-and-node setup (or the newer distributed mode) that lets tests run in parallel across multiple machines, browsers, and OS combinations; needed once a suite is large enough, or the team needs enough browser coverage, that sequential runs on one machine take too long.
- How do you handle file uploads in Selenium?
sendKeys()with the file's absolute path on a native<input type="file">element, which avoids opening the OS file dialog that Selenium cannot interact with directly; a candidate should flag that a custom (non-native) upload widget needs a different approach. - How do you debug a flaky test? A strong candidate walks through isolating the test (run it alone, repeatedly), checking for timing issues (missing or wrong waits), checking test independence (shared state or ordering), and checking environment factors (network, data, browser version) before assuming the application itself is broken.
- What is the difference between TestNG and JUnit for a Selenium suite? TestNG has built-in parallel execution, data providers, and more flexible test grouping and dependencies out of the box; JUnit 5 has closed much of that gap with extensions and
@ParameterizedTest, so the choice often comes down to team familiarity and existing tooling. - How do you handle Shadow DOM elements in Selenium? Modern Selenium 4+ supports accessing shadow roots directly (
getShadowRoot()); a candidate who mentions this, instead of only older JavaScript-executor workarounds, signals they are current on the tool.
Scenario-based Selenium interview questions
Scenario questions show how a candidate reasons under realistic pressure, which matters more for day-to-day QA work than reciting API calls.
- "Our Selenium suite passes locally but fails intermittently in CI. How do you investigate?" Look for a structured approach: check for timing differences between environments, missing waits that only show up under CI's slower or more loaded conditions, screen resolution or headless-mode rendering differences, and test order dependencies, rather than one guess.
- "A locator that worked for months suddenly breaks after a front-end release. What do you do?" A strong answer inspects the new DOM, updates the locator in the Page Object class (not the test itself), and raises whether a more resilient locator (a stable
data-testidattribute, for example) would prevent the same break next time. - "You're given a suite with 500 Selenium tests that takes 3 hours to run. How would you speed it up?" Expect ideas such as parallel execution across a grid, splitting the suite by tags (smoke vs. full regression), removing redundant UI coverage that a faster API or unit test already covers, and headless runs where visuals do not matter.
- "A test asserts on text that is correct in English but the suite also runs against a localized build. How do you handle it?" A candidate should favor asserting on stable attributes (IDs, test attributes, element state) over visible text where possible, or pulling expected strings from the same localization resource file the application uses, instead of hardcoding English text.
- "Walk me through how you'd automate a login flow end to end." Look for a sequence: navigate to the login page, locate and fill the username and password fields, click submit, wait for a post-login element (not a fixed sleep) to confirm success, and handle the failure case (wrong credentials) as a separate, deliberate test.
What are common red flags in a Selenium interview?
Across the teams that run these interviews, the same few patterns separate a strong hire from a costly miss.
- Reciting syntax with no reasoning: a candidate who can list every
Bylocator but cannot say why CSS selectors are usually preferred over XPath likely has not written tests against a real, changing application. - No mention of waits or flakiness: anyone who has maintained a Selenium suite for more than a few weeks has hit flaky tests; a candidate with nothing to say here may be newer than their resume suggests, or exaggerating depth.
- Framework knowledge with no "why": describing a Page Object Model structure without explaining the maintenance problem it solves suggests memorized interview prep rather than applied experience.
- Treating Selenium as the only tool: strong candidates can place Selenium relative to newer options (Playwright, Cypress) for browser automation, and explain when each fits, rather than treating Selenium as the only answer.
How do you score Selenium interview answers?
A simple 1 to 5 scale keeps interviewers consistent when comparing candidates for the same role. According to the Stack Overflow Developer Survey, Selenium remains one of the most widely used test automation tools among professional developers, so a consistent scoring rubric matters: most hiring teams will see many candidates who have touched it at some level, and the rubric is what separates surface familiarity from real depth.
Key takeaway: consistent scoring, not clever questions, is what makes a Selenium interview comparable across candidates.
Score | What it looks like |
|---|---|
1 | Cannot explain the concept beyond a definition; no example from real work |
2 | Partial or shaky answer; needs significant prompting to get to a usable answer |
3 | Correct, textbook-level answer; limited depth or no real-world nuance |
4 | Correct answer plus a real example or tradeoff from their own experience |
5 | Correct, with reasoning, a real example, and awareness of edge cases or alternatives |
Pro tip: Pair 4 to 6 of these questions with a short, timed hands-on task, such as fixing a given flaky test or writing one Page Object method. A candidate's live reasoning on a real locator or wait problem tells you more in 15 minutes than another 10 verbal questions. In my work with hiring teams, this single change catches more weak hires than adding extra verbal questions ever does.
How Testlify helps you screen Selenium skills before the interview
Interview time is limited, so most teams use a skills test to filter candidates before anyone sits down with these questions. Testlify's Selenium skills test checks WebDriver, locators and framework concepts automatically, so interviewers spend their time on judgment calls like the scenario questions above, not on basic screening. For the full hiring process around this role, see Testlify's guide to QA engineer interview questions, which covers the broader QA skill set beyond Selenium specifically.
Ready to screen Selenium skills before the interview? Browse the Testlify test library or start a 7-day free trial, no credit card required.
FAQ
How many Selenium interview questions should I ask in one interview? Most hiring teams use 6 to 10 questions across skill levels in a 45 to 60 minute interview, leaving time for a short hands-on task and the candidate's own questions.
Is Selenium still relevant given newer tools like Playwright and Cypress? Yes. Selenium remains widely used, especially in established enterprise test suites and for its broad multi-language, multi-browser support; many teams run Selenium and a newer tool side by side rather than replacing it outright.
Do I need a coding round in addition to these questions? For most automation engineer roles, yes. A short coding or debugging task alongside these conceptual questions is the best way to confirm hands-on ability, not just interview preparation.
What is a good follow-up if a candidate gives a weak answer on waits? Ask them to describe a specific flaky test they fixed and what the root cause turned out to be. A real example, even an imperfect one, is more informative than a textbook-perfect definition with no story behind it.
Content Writer
Yashika Khandelwal is a Content Writer with 3+ years of experience creating research-backed content on hiring, talent assessment, and HR technology. She is a registered Organizational Psychologist and subject matter expert who combines behavioral science with practical recruitment insights to produce accurate, evidence-based content.
LinkedInRelated resources
View all
Interview questions
Situational based interview questions: 30 examples for hiring teams

Interview questions
40 healthcare interview questions to ask candidates, with strong answers

Interview questions
35 cultural fit interview questions to ask candidates

Interview questions
30 academic advisor interview questions to ask in 2026

Interview questions
30 banker interview questions to ask in 2026

Interview questions
Web designer interview questions: 25 to ask and what good answers sound like
Get started.
Hire on proof, not resumes.
Run your first skills-based assessment free — no credit card required.