Selenium WebDriver Automation Interview
Curated 20+ questions covering WebDriver architecture, locator strategies, waits, Page Object Model, iframe switching, and exceptions.
Difficulty Filters
Tools & Options
What is Selenium, and what are its core components?
Selenium is an open-source suite of tools used to automate web browser testing. Core components include:
1. Selenium IDE: A browser extension for record-and-playback testing.
2. Selenium WebDriver: A collection of language-specific bindings (Java, Python, C#) that send direct commands to browsers.
3. Selenium Grid: A server cluster used to run tests in parallel across different machines, browsers, and operating systems.
Explain the architecture of Selenium WebDriver.
In modern Selenium 4, the architecture is direct. The test script sends commands directly to the browser's native driver (e.g. ChromeDriver, GeckoDriver) using the W3C WebDriver standard protocol over HTTP. The browser driver translates these commands into native actions inside the browser and returns execution outputs back to the script.
What are the different locator strategies in Selenium?
Locators locate elements on a webpage. Strategies include: `ID`, `Name`, `ClassName`, `TagName`, `LinkText`, `PartialLinkText`, `CSS Selector`, and `XPath` (XML path). ID is preferred for speed and uniqueness, followed by CSS selectors.
Explain the difference between absolute XPath and relative XPath.
Explain the difference between Implicit, Explicit, and Fluent Waits in Selenium.
What is Page Object Model (POM) in Selenium?
What is the PageFactory class, and what does `@FindBy` do?
How do you handle JavaScript alerts or confirmation boxes in Selenium?
How do you handle iframe switching in Selenium?
What are some common exceptions in Selenium, and how do you handle them?
How do you execute JavaScript code in Selenium?
Explain the difference between `close()` and `quit()` in Selenium.
How do you handle dropdowns in Selenium?
How do you perform mouse actions (like hover, double click, right click) in Selenium?
Explain the W3C WebDriver Standard.
How do you capture screenshots in Selenium?
What is headless browser execution, and how is it enabled?
How do you handle cookies in Selenium?
Explain Selenium Grid hub and node architecture.
What is a Stale Element Reference Exception, and why does it occur?
Technical Interview Mastery Blueprint
Proven methodologies and frameworks to succeed in technical and architecture rounds.
1. The Engineering STAR Technique
When responding to architectural or situational questions, structure your answer using Situation, Technical Constraint, Action, and Measurable Result. Rather than jumping straight to syntax, articulate the business problem, why certain patterns (e.g. caching, queuing, immutability) were selected over alternatives, and what latency or throughput improvements were achieved.
2. Defending Architectural Trade-Offs
Senior interviewers evaluate how you weigh trade-offs. Always explain why you chose an approach: e.g., memory overhead vs CPU cycle speed, consistency vs availability (CAP theorem), or normalized schemas vs denormalized fast reads. Stating the drawbacks of your own proposal demonstrates maturity and production experience.
3. Clean Code & Edge-Case Proactivity
In live-coding rounds, communicate your thinking aloud before typing. State edge cases explicitly: null or undefined inputs, extreme boundary values, concurrency races, and network timeouts. Writing modular, well-named functions with deterministic unit tests separates junior candidates from staff-level engineers.
4. Antipatterns to Avoid
Avoid reciting memorized definitions without practical context. Never dismiss non-functional requirements such as security (CSRF, injection, token rotation), observability (logging, metrics), and accessibility (ARIA, semantic standards). Always ask clarifying scope questions before writing complex implementations.
Explore Related Tools
Hand-picked utilities and calculators related to this tool.
