Selenium Interview Questions 2025
Selenium is the worldβs leading open-source tool for web automation testing. Whether you are a beginner or an experienced tester, cracking Selenium interviews requires understanding locators, WebDriver, waits, POM, Selenium Grid, and real-world testing scenarios.
1. What is Selenium?
Selenium is an open-source automation tool used to test web applications across browsers and platforms.
Components:
-
Selenium IDE β Record & playback tool
-
Selenium WebDriver β Browser automation API
-
Selenium Grid β Parallel test execution
-
Selenium RC β Legacy tool (deprecated)
2. Selenium Locators
Locators identify web elements.
Types: ID, Name, Class Name, Tag Name, Link Text, Partial Link Text, CSS Selector, XPath
Example:
3. driver.close() vs driver.quit()
Method | Action |
---|---|
driver.close() | Closes current browser window |
driver.quit() | Closes all windows and ends session |
4. Handling Checkboxes
5. Handling Dropdowns
6. findElement() vs findElements()
-
findElement()
β Returns first element, throws exception if not found -
findElements()
β Returns list, empty if none found
7. Opening a Webpage
8. Selenium WebDriver
WebDriver automates browsers directly without a server.
9. Absolute vs Relative XPath
XPath | Example |
---|---|
Absolute | /html/body/div[1]/input |
Relative | //input[@id='username'] |
10. Mouse Actions
Medium Questions (11β20) <a name="medium-questions"></a>
11. Selenium Waits
-
Implicit Wait: Global wait
-
Explicit Wait: Wait for specific condition
-
Fluent Wait: Polling frequency and exceptions
12. Handling Alerts
13. Multiple Windows
14. Handling Frames
15. Keyboard Actions
16. Screenshots
17. Scrolling Using JS
18. Page Object Model (POM)
19. Dynamic Elements
20. Selenium Grid
-
Parallel execution across browsers and OS
-
Reduces total execution time
Diagram suggestion: Grid hub + nodes layout
Hard Questions (21β30) <a name="hard-questions"></a>
21. AJAX Elements
22. File Upload
23. Headless Mode
24. SSL Certificate Handling
25. Console Logs
26. Drag & Drop
27. Dynamic Tables
28. Assert vs Verify
-
assert
β Stops test execution if fails -
verify
β Logs failure, continues execution
29. Selenium Limitations
-
Cannot automate desktop applications
-
Limited support for Captcha & images
-
No built-in reporting
30. Integration with TestNG/JUnit
-
TestNG annotations:
@Test
,@BeforeMethod
,@AfterMethod
-
Enables parallel execution and detailed reports
βοΈ By Not available | 2025-10-21T09:08:23.979Z