Interview guides / Selenium automation testing interview questions
Selenium Automation Testing Interview Questions and Answers 2026
Welcome to the ultimate guide for Selenium automation testing interviews in 2026. This guide is crafted specifically for freshers and early professionals from tier-2 and tier-3 colleges in India. It contains simple, practical, and direct answers that you can speak out loud during your technical rounds. Master these core concepts, locators, exceptions, and framework designs to clear your next QA interview with confidence.
Try Jawab AI freeBasic Selenium and Locators
1. What is Selenium and why is it used?
Selenium is an open-source tool used for automating web browsers. It is mainly used for regression and functional testing of web applications across different browsers like Chrome, Firefox, and Edge. Interviewer check: They want to know if you understand the primary purpose of automation testing.
2. What are the different components of Selenium?
Selenium has four main components: Selenium IDE, Selenium RC, Selenium WebDriver, and Selenium Grid. Today, we mostly use Selenium WebDriver for writing scripts and Selenium Grid for parallel execution across multiple machines. Interviewer check: Your knowledge of the Selenium suite architecture.
3. What is the difference between findElement() and findElements()?
findElement() returns a single WebElement and throws a NoSuchElementException if the element is not found. findElements() returns a list of WebElements and returns an empty list if no matching element is found instead of throwing an error. Interviewer check: Your understanding of WebDriver methods and exception handling.
4. What are the different locators available in Selenium?
The main locators in Selenium are ID, Name, ClassName, TagName, LinkText, PartialLinkText, XPath, and CSS Selector. ID and Name are the fastest and most preferred if they are unique. Interviewer check: Basic web element identification skills.
5. What is the difference between absolute and relative XPath?
An absolute XPath starts from the root node using single slashes like /html/body/div/input, and it breaks easily if the UI changes. A relative XPath starts from any node using double slashes like //input[@id='username'], which is shorter and safer to use. Interviewer check: Your ability to write robust locators.
WebDriver Commands and Actions
6. What is the difference between driver.get() and driver.navigate().to()?
Both are used to open a URL. driver.get() waits for the entire page to load before moving to the next command. driver.navigate().to() opens the URL and does not wait for the page to load fully; it also supports browser history navigation like back, forward, and refresh. Interviewer check: WebDriver navigation mechanics.
7. How do you handle alerts in Selenium?
We use the Alert interface. First, we switch the driver focus to the alert using driver.switchTo().alert(). Then we can use methods like alert.accept() to click OK, alert.dismiss() to click cancel, or alert.getText() to read the message. Interviewer check: Handling popups and JavaScript alerts.
8. How do you handle multiple windows or tabs in Selenium?
We use driver.getWindowHandle() to get the current window ID and driver.getWindowHandles() to get all open window IDs as a set. We then iterate through the set and use driver.switchTo().window(windowId) to switch focus to the required tab. Interviewer check: Managing window handles in automation.
9. What is the difference between close() and quit() methods?
driver.close() closes only the current browser window that the driver is focusing on. driver.quit() closes all browser windows and browser sessions opened by the test script. Interviewer check: Proper resource cleanup in tests.
10. How do you perform mouse and keyboard actions in Selenium?
We use the Actions class for advanced interactions like mouse hover, right-click, drag and drop, and keyboard events. For example: Actions act = new Actions(driver); act.moveToElement(element).perform();. Interviewer check: Advanced user interaction handling.
Waits and Synchronization
11. Why do we need waits in Selenium?
Web pages take time to load elements due to network latency or heavy JavaScript. Without waits, the script might try to interact with an element before it appears on the DOM, resulting in a NoSuchElementException. Interviewer check: Understanding synchronization issues in web testing.
12. What is an Implicit Wait?
An Implicit Wait tells the WebDriver to poll the DOM for a certain amount of time when trying to find an element if it is not immediately available. It is set once per session. Example: driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(10));. Interviewer check: Basic timeout configuration.
13. What is an Explicit Wait?
An Explicit Wait is used to wait for a specific condition, such as elementToBeClickable or visibilityOfElementLocated, before proceeding. It is applied to a specific element and is much smarter and preferred over implicit waits. Interviewer check: Writing robust and dynamic synchronization code.
14. What is a Fluent Wait?
Fluent Wait is used to define the maximum amount of time to wait for a condition, as well as the frequency with which to check the condition before throwing an exception. It also allows us to ignore specific exceptions like NotFoundException during the wait. Interviewer check: Advanced waiting strategies.
15. What happens if you mix Implicit and Explicit waits?
Mixing implicit and explicit waits can cause unpredictable wait times and unexpected delays, because the implicit wait might interfere with the explicit wait condition checks. It is always best to use explicit waits exclusively in modern frameworks. Interviewer check: Best practices in automation architecture.
Frameworks and Advanced Concepts
16. What is Page Object Model (POM) and why do we use it?
Page Object Model is a design pattern where every web page has a corresponding class file containing its web elements and actions. It improves code readability, prevents code duplication, and makes maintenance easy when UI changes happen. Interviewer check: Framework design knowledge.
17. How do you handle dropdowns in Selenium?
If the dropdown is created using the <select> tag, we use the Select class in Selenium with methods like selectByVisibleText(), selectByIndex(), or selectByValue(). If it is a custom dropdown without a select tag, we simply click on the dropdown element and click the desired option from the list. Interviewer check: Practical web element handling.
18. How do you take screenshots in Selenium?
We use the TakesScreenshot interface. We cast the driver instance to TakesScreenshot and call the getScreenshotAs() method, then save the output file using FileUtils.copyFile(). Example: File src = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);. Interviewer check: Debugging and reporting capabilities.
19. What is TestNG and what are some of its annotations?
TestNG is a testing framework inspired by JUnit. Common annotations include @Test, @BeforeMethod, @AfterMethod, @BeforeClass, and @AfterClass, which help control the execution flow and order of test cases. Interviewer check: Test runner and assertion management.
20. How do you handle frames or iframes in Selenium?
When a web element is inside an iframe, Selenium cannot locate it directly. We must first switch the driver focus to the frame using driver.switchTo().frame() by passing the frame name, ID, index, or WebElement, and then switch back using driver.switchTo().defaultContent(). Interviewer check: Handling complex web layouts.
Tips for the interview
- Practice writing relative XPaths on popular e-commerce sites to build strong locator skills.
- Understand the difference between checked and unchecked exceptions thrown by Selenium WebDriver.
- Be ready to explain your final year project framework or a dummy Page Object Model setup clearly.
- Always emphasize clean code, proper variable naming, and code reusability during technical rounds.
- Revise core Java concepts like encapsulation, inheritance, and exception handling as they form the backbone of Selenium frameworks.
Blank on a question? Not anymore.
Jawab AI listens to your interview and shows a clear answer on your screen in seconds, based on your resume. The desktop app stays invisible when you share your screen. Your first 3 sessions of 10 minutes are free.
Try Jawab AI freeMore interview guides
- Meta Software Engineer Interview Questions 2026 Guide
- Tech Mahindra Interview Questions for Freshers 2026
- Google Software Engineer Interview Questions 2026 Guide
- HCL Tech Interview Questions and Answers for Freshers 2026
- Behavioral Interview Questions and STAR Method Answers 2026
- Amazon Leadership Principles Interview Questions & STAR Answers 2026
- Manual Testing Interview Questions for Freshers 2026
- Spring Boot Interview Questions and Answers 2026
These are commonly asked questions with sample answers, not an official list. Hiring processes change, so check the company's careers page for the current one. Jawab AI is not affiliated with any company named here.