Practice 45 Selenium interview questions on WebDriver, locators, waits, page objects, frames, alerts, actions, Grid, CI, flaky tests, and browser automation.
45 questions with answersKey Takeaways
Selenium is a browser automation project used to test web applications through real browsers. Selenium WebDriver sends commands to a browser driver, finds elements, clicks, types, waits, switches contexts, and verifies browser behavior. In interviews, Selenium questions test whether you can write stable UI tests, choose locators, use waits correctly, handle dynamic pages, and debug flaky failures.
Watch: Selenium WebDriver Tutorial in 3 Hours
Video: Selenium WebDriver Tutorial in 3 Hours (Selenium training video, YouTube)
Test yourself and earn a certificate
6 quick questions. Score 70%+ to download your Selenium certificate.
Start here. These are the definitions and first-principle checks that open most rounds.
Selenium WebDriver is the API that controls a browser through browser-specific drivers.
It sends commands such as find element, click, type, and open pages in a real browser.
WebDriver changes Selenium decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.
Watch a deeper explanation
Video: Selenium WebDriver Tutorial in 3 Hours (Selenium training video, YouTube)
A browser driver translates WebDriver commands into browser actions.
ChromeDriver, GeckoDriver, and EdgeDriver are common examples.
Browser driver changes Selenium decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.
A locator tells WebDriver how to find an element on the page.
Common locators include id, name, CSS selector, XPath, link text, and tag name.
Locator changes Selenium decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.
Use CSS selectors for stable, readable element selection based on ids, classes, attributes, and hierarchy.
CSS is usually faster and cleaner than complex XPath.
CSS selector changes Selenium decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.
| Answer part | What to say | Evidence to mention |
|---|---|---|
| Definition | CSS selector in one direct sentence. | Official docs or course material |
| Use case | The work where it changes a decision. | Dataset, model, query, dashboard, or pipeline |
| Risk | What breaks when it is misunderstood. | Metric, log, test result, or review note |
XPath is useful when locating by text, complex relationships, or document structure not covered cleanly by CSS.
Avoid brittle absolute XPath.
XPath changes Selenium decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.
Stable Selenium test path
Flaky tests usually fail at locator or wait design.
Watch a deeper explanation
Video: Selenium course for beginners (freeCodeCamp.org, YouTube)
Implicit wait makes WebDriver poll for elements for a set time before throwing not found errors.
It is global and can hide timing problems.
Implicit wait changes Selenium decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.
Explicit wait waits for a specific condition, such as visibility or clickability, before continuing.
It is the preferred wait for dynamic pages.
Explicit wait changes Selenium decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.
Fluent wait lets you configure timeout, polling interval, and ignored exceptions.
It is useful for custom wait conditions.
Fluent wait changes Selenium decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.
A stale element reference happens when the DOM changed after WebDriver found the element.
Find the element again after the page updates.
Stale element changes Selenium decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.
Elements inside iframes require WebDriver to switch into the frame before interacting.
Switch back to default content afterward.
Frame changes Selenium decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.
Switch to the alert, then accept, dismiss, or read its text.
A modal alert blocks normal page interaction.
Alert changes Selenium decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.
A window handle identifies a browser window or tab controlled by WebDriver.
Use handles when actions open new tabs or windows.
Window handle changes Selenium decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.
The Actions API performs advanced user gestures such as hover, drag, key chords, and pointer actions.
It is useful for menus and drag-and-drop flows.
Actions API changes Selenium decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.
Watch a deeper explanation
Video: Selenium WebDriver introduction (Automation tutorial, YouTube)
Page Object Model stores page locators and actions in page classes or modules.
It reduces duplication and keeps tests readable.
Page Object Model changes Selenium decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.
Selenium Grid runs WebDriver tests on remote browsers across machines, browser versions, and operating systems.
It supports parallel and cross-browser execution.
Selenium Grid changes Selenium decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.
These questions test whether you can apply the topic to real data, real code, and messy constraints.
Open the login page, enter credentials, submit, wait for a logged-in signal, and assert the dashboard or session state.
Use test data and avoid checking only URL changes.
login test changes Selenium decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.
WebElement email = wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("email")));
email.sendKeys("qa@example.com");
driver.findElement(By.id("password")).sendKeys("secret");
driver.findElement(By.cssSelector("button[type='submit']")).click();
wait.until(ExpectedConditions.urlContains("dashboard"));Prefer stable test ids or ids, then accessible labels, names, CSS selectors, and only then XPath when needed.
Do not depend on generated class names.
locator strategy changes Selenium decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.
Use explicit wait with a clickable condition for the button locator.
This waits for the real condition instead of a fixed pause.
explicit wait changes Selenium decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.
Wait for table data to load, locate rows by stable text or data attributes, and assert the expected row values.
Avoid row index assumptions when sorting or filtering can change order.
dynamic table changes Selenium decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.
Wait for the iframe, switch into it, interact with the element, then switch back to default content.
Frame switching is a common missed step.
iframe test changes Selenium decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.
Store current handle, perform the action, wait for new handle, switch to it, assert, then close or switch back.
Do not assume tab order without checking handles.
new tab changes Selenium decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.
Send the file path to an input element of type file when the app uses a normal file input.
Native OS dialogs are outside normal WebDriver control.
file upload changes Selenium decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.
Take screenshot, store page source or logs, record test name, browser, URL, and step details.
Evidence makes failures reproducible.
screenshot on failure changes Selenium decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.
Keep locators and page actions in one class or module, and keep assertions in tests unless they are page-specific checks.
Do not put every workflow into one huge page object.
page object changes Selenium decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.
Use the test framework's parameterization or data provider and keep test data external or generated safely.
Data setup and cleanup matter.
data-driven test changes Selenium decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.
Watch a deeper explanation
Video: Selenium WebDriver setup (Automation tutorial, YouTube)
Use isolated browser sessions, independent test data, no shared mutable state, and Grid or cloud browsers where needed.
Parallel runs expose hidden test coupling.
parallel execution changes Selenium decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.
Use headless or remote browsers, stable test data, artifacts, retries only for known infrastructure issues, and clear reports.
CI browser versions should be controlled.
CI run changes Selenium decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.
Reproduce it, check waits, locators, test data, environment, browser logs, and app timing before changing the assertion.
Retries hide symptoms if root cause is not fixed.
flaky test fix changes Selenium decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.
Run a focused suite across target browsers and versions, not every test on every browser by default.
Pick coverage based on user analytics and risk.
browser compatibility changes Selenium decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.
Use it for limited cases such as reading browser state or working around controls after confirming normal user action is not possible.
Overuse can make tests stop matching real user behavior.
JavaScript executor changes Selenium decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.
Advanced rounds test trade-offs, failure modes, and whether the decision can hold up under production pressure.
Check overlays, scrolling, disabled state, wrong locator, animation, and whether the click target is ready.
Use an explicit wait for the real clickable state.
element not clickable changes Selenium decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.
The DOM refreshed after the element was found.
Find the element again after the update.
stale element changes Selenium decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.
Check browser version, screen size, headless behavior, timing, test data, environment variables, and network speed.
CI is a different environment.
works locally fails CI changes Selenium decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.
Use stable, intent-based locators instead of brittle DOM paths.
Absolute XPath couples tests to layout.
absolute XPath failure changes Selenium decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.
Tests become slow and still flaky because fixed sleeps do not match real page timing.
Use explicit waits.
sleep-heavy suite changes Selenium decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.
Switch to the alert or modal context and handle it before continuing.
Blocked UI prevents normal element actions.
modal blocks test changes Selenium decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.
Check node capacity, browser mix, parallelism settings, test duration, and stuck sessions.
Grid needs capacity management.
grid capacity changes Selenium decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.
The suite may become slow, brittle, and costly to maintain.
Move lower-level checks to API and unit tests.
overautomated UI changes Selenium decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.
Check Actions API support, browser behavior, HTML5 implementation, and whether a lower-level test fits better.
Some gestures are harder to automate reliably.
drag fails changes Selenium decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.
It does not verify business outcome.
Every test needs meaningful assertions.
test passes without assertion changes Selenium decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.
Check browser driver and browser version compatibility.
Driver management matters.
driver mismatch changes Selenium decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.
Check async processing, third-party sandbox, waits, test data, and whether the assertion should happen at API or database level.
UI may not be the best layer for every check.
flaky checkout changes Selenium decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.
Ask about locator strategy, waits, page objects, test data, parallel runs, reports, CI, Grid, flake handling, and scope.
These decide maintainability.
senior review changes Selenium decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.
Selenium has multiple parts. Most interviews focus on WebDriver, but experienced candidates should know where Grid and IDE fit.
| Tool | Purpose | Best use | Interview warning |
|---|---|---|---|
| WebDriver | Automates browsers through code | Real UI automation suites | Needs synchronization and locator discipline |
| Grid | Runs tests across machines and browsers | Parallel cross-browser runs | Adds environment and capacity issues |
| IDE | Records and plays simple browser steps | Learning or quick demos | Not enough for maintainable suites |
| Browser driver | Bridge between WebDriver and browser | ChromeDriver, GeckoDriver, EdgeDriver | Version mismatch can break runs |
Selenium answer signals
Stable automation matters more than memorizing methods.
Prepare by automating one real flow: open browser, locate elements, wait for state, perform actions, assert results, and debug a failed run.
Selenium interview prep flow
Most rounds reward clear reasoning more than memorized phrasing.
A strong Selenium answer explains why a test will be stable. Say which locator you choose, what page state you wait for, what assertion proves the behavior, and how the test reports failure. production-ready answers mention page objects, test data, parallel runs, Grid capacity, browser-driver versions, screenshots, network or console logs, and how to keep UI tests focused on high-value flows.
Wait for a meaningful browser state instead of sleeping for a fixed number of seconds.
Prefer test ids, stable ids, names, labels, and accessible roles over brittle absolute XPath.
Browser tests are slower and more brittle than API or unit tests, so automate critical user paths.
Screenshots, page source, browser logs, and step logs make failures actionable.
6 questions, about 4 minutes. Score 70% or higher to earn a shareable certificate.
Hyring's AI Video Interviewer and AI Coding Interviewer help teams score test automation rounds. Use this Selenium bank to prepare clear WebDriver answers before the screen.
See Hyring AI Video Interviewer