All interview questions Testing · 2026

Selenium Interview Questions

Selenium is the most common automation-testing topic in QA and SDET interviews. These are the questions interviewers actually ask, with concise answers you can speak confidently.

16 questions with concise, interview-ready answers.

1. What is Selenium?

Selenium is an open-source suite for automating web browsers, used mainly to test web applications. It supports multiple programming languages (Java, Python, C#, JavaScript) and all major browsers through the WebDriver standard.

2. What are the components of Selenium?

Selenium IDE (a record-and-playback browser extension for quick scripts), Selenium WebDriver (programmatic, language-binding browser control), and Selenium Grid (parallel and distributed test execution). Selenium RC was the older component and is now deprecated.

3. What is Selenium WebDriver?

WebDriver is the core API that controls a browser natively through a browser-specific driver (e.g. ChromeDriver), without a middle server. It is faster and more reliable than the old Selenium RC and is the foundation of modern Selenium tests.

4. What is the difference between findElement and findElements?

findElement returns the first matching WebElement and throws NoSuchElementException if nothing matches. findElements returns a List of all matches and an empty list (no exception) when nothing is found.

5. What locator strategies does Selenium support?

id, name, className, tagName, linkText, partialLinkText, cssSelector, and xpath. id and cssSelector are generally the fastest and most reliable choices.

6. XPath vs CSS selector — which should you use?

CSS selectors are usually faster and more readable, so prefer them by default. Use XPath when you need its extra power — traversing up the DOM, selecting by visible text, or axes — which CSS cannot do.

7. What is the difference between absolute and relative XPath?

Absolute XPath starts from the root (/html/body/...) and breaks easily when the DOM changes. Relative XPath (//tag[@attr='value']) can start anywhere in the document and is far more robust, so it is preferred.

8. How do you handle dynamic elements in Selenium?

Locate them with stable attributes and relative XPath/CSS using contains() or starts-with(), and synchronize with explicit waits (WebDriverWait + ExpectedConditions) instead of hard-coded Thread.sleep().

9. What is the difference between implicit, explicit, and fluent waits?

Implicit wait sets a single global polling timeout for all element lookups. Explicit wait (WebDriverWait) waits for a specific condition on a specific element. Fluent wait is an explicit wait with a custom polling interval and ignored exceptions. Avoid mixing implicit and explicit waits.

10. How do you handle dropdowns in Selenium?

For native <select> elements use the Select class — selectByVisibleText, selectByValue, or selectByIndex. For custom (non-<select>) dropdowns, click to open it and select the option as a normal WebElement.

11. How do you handle JavaScript alerts and popups?

Switch to the alert with driver.switchTo().alert(), then call accept() to confirm, dismiss() to cancel, getText() to read it, or sendKeys() for prompt inputs.

12. How do you handle multiple windows or tabs?

Use getWindowHandles() to get all window IDs, store the current one from getWindowHandle(), then loop and call switchTo().window(handle) to move to the target window.

13. How do you handle frames and iframes?

Switch into the frame with driver.switchTo().frame(index | name | WebElement), interact with the elements inside, then call switchTo().defaultContent() to return to the main page.

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

POM is a design pattern where each page is represented by a class that encapsulates its locators and actions. It reduces duplication, improves maintainability, and makes tests readable. PageFactory is a Selenium helper for initializing those elements.

15. How do you take a screenshot in Selenium?

Cast the driver to TakesScreenshot, call getScreenshotAs(OutputType.FILE), and copy the returned file to your destination path. Screenshots are commonly captured on test failure for debugging.

16. What is Selenium Grid and why use it?

Selenium Grid runs tests in parallel across multiple machines and browser/OS combinations using a hub-and-node (Grid 4) architecture. It dramatically cuts execution time and enables cross-browser testing.

Get these answered live in your real interview

NostrobeAI is a real-time AI interview copilot — it hears the question and drafts a strong answer on your screen, invisible on Zoom, Meet, and Teams. One-time pricing, no subscription.

Try NostrobeAI free