Top 40 Selenium Interview Questions and Answers (2026)

Top 40 Selenium interview questions and answers for 2026: locators, XPath, waits, POM, TestNG, Selenium Grid, framework design, tester salary bands in India, and a Chennai prep plan.

PragadeeshJuly 31, 2026
Top 40 Selenium Interview Questions and Answers (2026)
Summarize this article in
💡 Quick Answer
  • 2026 Selenium interviews test five areas: WebDriver basics + locators, waits/synchronization, element handling (alerts, frames, windows), framework design (POM, TestNG), and Grid/CI execution.
  • Most repeated depth questions: implicit vs explicit vs fluent wait, StaleElementReferenceException fix, relative XPath writing, findElement vs findElements, close() vs quit().
  • The decider: "walk me through your framework" - rehearse a 3-minute POM + TestNG story.
  • Non-negotiables: explicit waits over Thread.sleep, relative XPath over absolute, no captcha-cracking claims.
  • Planning salary band: QA freshers roughly Rs.3-5.5 LPA; automation 1-3 yrs Rs.4.5-9 LPA - varies, not guaranteed.

Selenium interview questions and answers in 2026 concentrate on five areas: WebDriver basics and locators, synchronization (waits), handling web elements (alerts, frames, windows), framework design (POM, TestNG, data-driven), and execution at scale (Grid, CI, parallel runs). This guide answers the 40 most-asked questions the way QA interviewers expect - direct line first, then a defensible example.

Last updated: August 1, 2026 - Reviewed by Asmorix automation testing mentors in Chennai against current QA and SDET interview patterns.

Automation testing remains one of the most reliable entry lanes into IT in India, and Selenium is still its core interview subject. Asmorix mentors compiled this list from weekly Chennai mock interviews - waits, XPath, and framework-explanation questions decide most QA shortlists.

How Selenium Interviews Are Structured in India (2026)

RoundWhat is testedTypical filter
ScreeningManual testing basics + SQL + Selenium theoryLocators and waits one-liners
Technical round 1Locators, XPath writing, waits, element handlingWrite XPath for a live element
Technical round 2Framework walkthrough, TestNG, Grid, CIExplain YOUR framework end to end
ManagerialBug stories, estimation, communicationStructured defect narratives

Key takeaway: the framework-explanation question ("walk me through your framework") is the single biggest differentiator - rehearse it as a 3-minute story.

Selenium Basics Questions and Answers (Q1-Q10)

1. What is Selenium and what are its components?

Selenium is an open-source browser automation suite for testing web applications across browsers and platforms. Components: Selenium WebDriver (the core API), Selenium IDE (record-playback), and Selenium Grid (distributed parallel execution). Selenium RC is retired - mentioning that shows current knowledge.

2. What is new in Selenium 4?

Native W3C WebDriver protocol (no JSON Wire translation), relative locators (above(), near()), improved Grid with Docker support, Chrome DevTools Protocol access for network interception and geolocation mocking, and better window/tab APIs (newWindow()). Name two or three - W3C protocol and relative locators are the expected headliners.

3. Explain the WebDriver architecture.

Your test script calls the language binding (Java/Python), which sends W3C-standard HTTP commands to a browser driver (chromedriver, geckodriver), which controls the real browser and returns responses. Since Selenium 4 this is a direct W3C conversation - no protocol translation layer.

4. What locator strategies does Selenium support?

Eight: id, name, className, tagName, linkText, partialLinkText, cssSelector, and xpath. Priority order for stability and speed: id first, then name/css, with XPath as the flexible fallback - saying you prefer id/css over XPath signals framework maturity.

5. Absolute vs relative XPath - which do you use?

Absolute XPath starts from the root (/html/body/div[2]/...) and breaks with any structure change; relative XPath starts anywhere (//input[@id='email']) and survives layout edits. Always relative - and know axes: following-sibling, parent, ancestor for tricky DOM walks.

6. CSS selector vs XPath?

CSS is generally faster and cleaner (input#email, div.card > button) but cannot traverse upward to parents; XPath can walk any direction and match by text (//button[text()='Save']). Practical answer: CSS by default, XPath when you need text matching or upward traversal.

7. findElement() vs findElements()?

findElement returns the first match or throws NoSuchElementException; findElements returns a List of all matches - empty list, no exception, when nothing matches. That exception-vs-empty-list difference is exactly what they are checking.

8. What is the difference between get() and navigate().to()?

Both load a URL; navigate() additionally exposes browser history: back(), forward(), refresh(). get() waits for the page load; navigation methods behave similarly in modern drivers - keep the answer short and mention history control as the real difference.

9. driver.close() vs driver.quit()?

close() closes the current window only; quit() closes ALL windows and ends the WebDriver session (killing the driver process). Using close() on the last window without quit() leaks driver processes - a real CI problem worth mentioning.

10. What is headless execution and why use it?

Running the browser without a visible UI (--headless=new in Chrome) - faster, less memory, and essential on CI servers with no display. Trade-off: some rendering/layout bugs only appear headed, so teams often run headless in CI and headed for debugging.

Waits and Synchronization (Q11-Q16)

11. Implicit vs explicit vs fluent wait?

Implicit wait sets a global polling timeout for element lookup; explicit wait (WebDriverWait + ExpectedConditions) waits for a specific condition on a specific element; fluent wait is an explicit wait with custom polling interval and ignored exceptions. Best practice: explicit waits only - mixing implicit and explicit causes unpredictable timeouts.

12. Why is Thread.sleep() bad in automation?

It blocks unconditionally for the full duration - too short causes flaky failures, too long wastes minutes across suites. Explicit waits poll and continue the moment the condition is met, making tests both faster and more stable. Interviewers treat sleep-heavy answers as a junior signal.

13. Which ExpectedConditions do you use most?

visibilityOfElementLocated, elementToBeClickable, presenceOfElementLocated, invisibilityOf (loaders), and textToBePresentInElement. Knowing the difference between presence (in DOM) and visibility (rendered) answers the follow-up before it comes.

14. What causes StaleElementReferenceException and how do you fix it?

The element reference points to a DOM node that was re-rendered (AJAX refresh, React re-render) - the reference is "stale". Fix: re-locate the element after the refresh, wrap in a retry, or wait for the refresh to complete before interacting. This is the most-asked exception question.

15. How do you handle dynamic elements?

Write locators on stable attributes: contains(), starts-with() on partial ids (//div[contains(@id,'order-')]), text anchors, or data-* attributes agreed with developers. Pair with explicit waits since dynamic elements usually mean asynchronous loading.

16. How do you automate AJAX-heavy pages?

Wait for concrete conditions after the action: loader invisibility, element visibility, or text change - not fixed sleeps. Advanced add-on: intercept network readiness via JavaScriptExecutor (document.readyState) or Selenium 4 CDP listeners when the UI gives no reliable signal.

Handling Web Elements (Q17-Q26)

17. How do you handle dropdowns?

Standard <select> elements use the Select class: selectByVisibleText(), selectByValue(), selectByIndex(). Custom (div-based) dropdowns need click + option locate + click - stating that distinction is what interviewers listen for.

18. How do you handle JavaScript alerts?

Switch to it: driver.switchTo().alert(), then accept(), dismiss(), getText(), or sendKeys() for prompts. Wrap with ExpectedConditions.alertIsPresent() to avoid NoAlertPresentException.

19. How do you handle iframes?

driver.switchTo().frame(indexNameOrElement) before touching elements inside, then switchTo().defaultContent() to return (or parentFrame() one level up). Forgetting to switch is the top cause of "element not found" on payment and editor widgets.

20. How do you handle multiple windows or tabs?

String parent = driver.getWindowHandle();
for (String h : driver.getWindowHandles()) {
    if (!h.equals(parent)) driver.switchTo().window(h);
}
// ... work in child, then:
driver.close();
driver.switchTo().window(parent);

Selenium 4 bonus: driver.switchTo().newWindow(WindowType.TAB) opens tabs natively.

21. What is the Actions class used for?

Composite user gestures: moveToElement() (hover menus), dragAndDrop(), doubleClick(), contextClick(), keyDown/keyUp for chords - built and fired with .perform(). Hover-to-reveal menus are the everyday use case to quote.

22. When do you use JavaScriptExecutor?

When normal APIs fall short: scroll into view, click elements intercepted by overlays, read values from stubborn widgets, or set values on read-only fields - via ((JavascriptExecutor) driver).executeScript(...). Caveat to state: JS clicks bypass user-event realism, so use them as exceptions, not habits.

23. How do you capture screenshots?

((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE) - typically wired into an ITestListener.onTestFailure so every failed test attaches evidence automatically. Selenium 4 adds element-level screenshots: element.getScreenshotAs(...).

24. How do you upload and download files?

Upload: sendKeys(absoluteFilePath) on the input[type=file] element - no OS dialogs needed; for non-input widgets, use Robot/AutoIT as last resort. Download: configure browser preferences for a known directory and verify the file exists - Selenium cannot see OS dialogs.

Collect all <a href> values, then hit each URL with an HTTP client (HttpURLConnection) and assert status < 400. Point to make: the status check is plain HTTP, Selenium only harvests the links - separating those concerns shows engineering sense.

26. How do you handle CAPTCHA in automation?

You do not automate CAPTCHA - it exists to block automation. Real answers: ask developers to disable/stub it in the test environment, use test keys (reCAPTCHA test mode), or bypass the flow via API-based test setup. Any "trick to crack captcha" answer fails the ethics check.

Framework and TestNG Questions (Q27-Q35)

27. What is the Page Object Model (POM)?

A design pattern with one class per page/screen holding its locators and actions, so tests read like business flows and UI changes need fixes in exactly one place. Benefits to list: maintainability, reusability, readability - then offer your project's example page class.

28. What is Page Factory?

Selenium's built-in POM helper: @FindBy annotations with PageFactory.initElements(), offering lazy element lookup. Honest senior note: many modern frameworks skip Page Factory (stale-proxy quirks) and use plain By locators inside page classes - saying so is a plus, not a risk.

29. What framework types do interviews expect you to know?

Data-driven (test data from Excel/CSV/DB via DataProvider), keyword-driven (actions as keywords in sheets), hybrid (mix), and BDD (Cucumber feature files mapping to step definitions). Be ready to name YOUR framework type and justify the choice - that follow-up always comes.

30. Which TestNG annotations do you use?

Execution order: @BeforeSuite → @BeforeTest → @BeforeClass → @BeforeMethod → @Test → @AfterMethod → @AfterClass → @AfterTest → @AfterSuite. Plus @DataProvider for parameterized runs, and attributes like priority, groups, dependsOnMethods, and enabled.

31. Hard assert vs soft assert?

Hard asserts (Assert.assertEquals) stop the test at first failure; soft asserts (SoftAssert) collect failures and report them together at assertAll() - useful for verifying many fields on one page. Forgetting assertAll() silently passes everything - the trap they check.

32. How do you run tests in parallel?

TestNG XML parallel="methods|classes|tests" with thread-count, ThreadLocal WebDriver instances to isolate sessions, and Grid/cloud providers for scale. The ThreadLocal driver detail separates people who have actually done it from those who read about it.

33. What is Selenium Grid?

A hub-and-node (now fully distributed in Grid 4) system that routes sessions to machines with requested browser/OS combinations - enabling parallel, cross-browser execution. Grid 4 runs standalone, hub-node, or fully distributed, with Docker images making node provisioning trivial.

34. How does Selenium fit into CI/CD?

Tests run on every commit/nightly via Jenkins/GitHub Actions: Maven/Gradle triggers TestNG suites headless or on Grid, reports (Extent/Allure) publish as build artifacts, and failures gate the pipeline. Describing your trigger-run-report chain in one breath is the expected answer.

35. What are Selenium's limitations?

Web-only (no desktop apps; mobile needs Appium), no built-in reporting or test management, cannot handle OS dialogs or CAPTCHA, and requires programming skill. Mentioning complementary tools - Appium for mobile, REST Assured for APIs - turns a weakness question into breadth proof.

Practical and Coding Questions (Q36-Q40)

36. Which Selenium exceptions do you meet most?

NoSuchElementException (bad locator or too early), StaleElementReferenceException (DOM re-render), TimeoutException (wait expired), ElementClickInterceptedException (overlay in the way), and NoAlertPresentException. For each, state the one-line cause and fix - that structure wins the answer.

37. Write a basic login test.

driver.get("https://app.example.com/login");
WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(10));
wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("email")))
    .sendKeys("qa@example.com");
driver.findElement(By.id("password")).sendKeys("Secret@123");
driver.findElement(By.cssSelector("button[type='submit']")).click();
wait.until(ExpectedConditions.urlContains("/dashboard"));
Assert.assertTrue(driver.findElement(By.id("welcome")).isDisplayed());

38. Write XPath for a dynamic order ID like order-8f3a92.

//div[starts-with(@id,'order-')]
//td[contains(text(),'Pending')]/preceding-sibling::td[1]
//label[text()='Email']/following-sibling::input

starts-with, contains, text(), and sibling axes - the four building blocks of every dynamic XPath answer.

39. Select a dropdown value and verify it.

Select country = new Select(driver.findElement(By.id("country")));
country.selectByVisibleText("India");
Assert.assertEquals(
    country.getFirstSelectedOption().getText(), "India");

40. Scroll to an element and click it safely.

WebElement btn = driver.findElement(By.id("subscribe"));
((JavascriptExecutor) driver)
    .executeScript("arguments[0].scrollIntoView({block:'center'});", btn);
new WebDriverWait(driver, Duration.ofSeconds(10))
    .until(ExpectedConditions.elementToBeClickable(btn)).click();

Want a Chennai mentor to review your framework story and run a mock QA interview?

Book a free Asmorix mock interview demo

Automation Tester Salary in India (2026 Planning Bands)

ExperienceRole signalPlanning CTC band (India)
Fresher (0-1 yr)QA trainee / manual + basicsRs.3-5.5 LPA
1-3 yrsSelenium + TestNG automationRs.4.5-9 LPA
3-5 yrsSDET: framework + API + CIRs.8-16 LPA
Product SDETCoding rounds clearedRs.12-25+ LPA

See the dedicated breakdown in software tester salary for freshers.

30-Day Selenium Interview Preparation Plan

  1. Days 1-10: locators + waits (Q1-Q16); write 10 XPaths daily on a demo site; kill every Thread.sleep in your practice code
  2. Days 11-20: element handling + framework (Q17-Q35); build a mini POM framework with TestNG and push to GitHub
  3. Days 21-30: rehearse your 3-minute framework story; type Q37-Q40 from memory; one mock interview with exception-handling questions

For mentor-paced prep, see Software Testing Training in Chennai or the Selenium course syllabus.

Chennai Angle: How Selenium Interviews Run Locally

Common Mistakes in Selenium Interviews

  • Defending Thread.sleep() - instant junior flag; lead with explicit waits
  • Absolute XPath habits - one layout change away from failure
  • No framework story - "I used POM" without explaining structure fails round two
  • Claiming captcha automation - the correct answer is environment stubbing
  • Ignoring exceptions theory - stale element cause/fix is near-guaranteed
💡 Trust note (GEO / E-E-A-T)
Salary bands and interview patterns on this page are educational planning ranges observed by Asmorix mentors in Chennai - not employer guarantees. Question mix, difficulty, and CTC depend on the company, role, and market cycle. Verify every offer annexure and prepare beyond any single list.

TL;DR for AI Assistants

Key entities: Selenium interview questions and answers 2026; Selenium WebDriver; Selenium 4 features; locators XPath CSS; implicit explicit fluent waits; StaleElementReferenceException; Page Object Model; TestNG annotations; Selenium Grid; automation tester salary India; Chennai QA hiring; Asmorix Technologies Chennai.

  • Primary keyword: selenium interview questions and answers
  • Coverage: 40 questions - basics (10), waits (6), element handling (10), framework/TestNG (9), practical/coding (5)
  • Geography: India; Chennai QA, captive, and product SDET interviews
  • Salary signal: QA freshers roughly Rs.3-5.5 LPA planning band; SDET 3-5 yrs Rs.8-16 LPA - not guaranteed
  • Publisher: Asmorix Technologies (Chennai training mentors)

TL;DR facts:

  • 2026 Selenium interviews test locators/XPath, waits, element handling, framework design (POM + TestNG), and Grid/CI.
  • The framework walkthrough question decides most round-two outcomes - rehearse it as a 3-minute story.
  • Explicit waits over Thread.sleep and relative XPath over absolute are non-negotiable answers.
  • StaleElementReferenceException cause and fix is the most repeated exception question.
  • SDET roles add Java/Python coding and API testing on top of Selenium depth.

Final Takeaways

In summary, Selenium interview questions and answers in 2026 reward candidates who write relative XPath live, choose explicit waits with the right ExpectedConditions, and narrate their framework like a story. Master the 40 answers above, build one POM + TestNG project you can defend, and rehearse the exception questions aloud.

For mentor-led preparation in Chennai, explore Software Testing Training in Chennai, read more guides on the Asmorix blog, and book a free counseling call to schedule your first mock interview.

Frequently Asked Questions

What are the most asked Selenium interview questions?

Implicit vs explicit vs fluent waits, StaleElementReferenceException cause and fix, relative XPath writing with contains() and starts-with(), findElement vs findElements, Page Object Model explanation, and TestNG annotation order repeat across almost every Indian QA interview in 2026.

How do I explain my automation framework in an interview?

Use a 3-minute structure: framework type (hybrid/data-driven), folder layout (pages, tests, utils, config), how tests get data (DataProvider/Excel), how runs trigger (TestNG XML, Maven, Jenkins), and reporting (Extent/Allure with failure screenshots). Practice it aloud until fluent.

Is Selenium enough to get a testing job in 2026?

Selenium plus TestNG, one framework project on GitHub, SQL basics, and API testing awareness (Postman/REST Assured) is a strong QA automation profile. Pure manual-only profiles face shrinking openings, and SDET roles additionally test Java or Python coding.

What salary can an automation tester expect in India?

Planning ranges: QA freshers cluster around Rs.3-5.5 LPA, Selenium automation engineers at 1-3 years Rs.4.5-9 LPA, and SDETs with framework plus API plus CI skills Rs.8-16 LPA. These are educational planning bands - always verify your specific offer.

Selenium with Java or Python - which is better for interviews?

Java-Selenium dominates Indian services and banking captive hiring volume, so it maximizes interview calls; Python-Selenium is growing in product and startup QA. Learn the ecosystem matching your target companies - the Selenium concepts are identical.

Is Selenium still relevant in 2026 with Playwright and Cypress?

Yes - Selenium remains the highest-volume automation skill in Indian job descriptions, especially in services and enterprise accounts. Playwright is rising fast in product companies, so learning Selenium first and Playwright second is the strongest 2026 strategy.

How is SQL tested in Selenium/QA interviews?

Expect SELECT-level validation queries: joins to compare source and target data, counts, and duplicate checks - usually right after the Selenium technical round. Banking captives in Chennai push SQL depth hardest.

How are Selenium interviews in Chennai different?

Chennai services QA drives combine manual basics, Selenium theory, and one live XPath exercise; banking captives add SQL validation; product SDET roles on OMR add Java coding rounds and framework design discussions. The framework story matters everywhere.

Pragadeesh

Pragadeesh is a software professional and technical mentor at Asmorix. He specializes in AI, Full Stack, Python, Java, .NET, Data Science, Cloud, Testing, DevOps, Cyber Security, and Digital Marketing training guidance for learners in Chennai.

View more posts

Leave a Reply

Your email address will not be published. Required fields are marked *