Selenium Interview Questions for Automation Testers | OfferBull

Selenium Interview Questions for Automation Testers
Stack trace on the shared screen. Timeout. The button that “always worked.”
You’ve fixed this class of bug before. Your mouth still wants Thread.sleep(5000) before your brain catches up. That half-second is what the interviewer writes down.
Selenium interview questions aren’t a glossary quiz. They poke how you think about drivers, waits you can defend, a Page Object that doesn’t rot, Grid runs that don’t collide, and a flaky story that isn’t just “CI is flaky.” For the wider loop, keep SDET interview questions open. Coding warmups: top coding interview patterns.
Samples are made up. Say them aloud. Reading silently hides the “um.”
WebDriver architecture (draw it)
Skip the textbook paragraph. Boxes.
Your test code talks to a language binding. Binding speaks W3C WebDriver over HTTP to a browser driver. Driver talks to Chrome, Firefox, whatever. Selenium 4 lives on that W3C protocol. JSON Wire is mostly interview trivia now.
Q: What actually happens on findElement?
I’d say: “Binding fires a find command at the driver. Driver asks the browser. I get a node id wrapped as a WebElement, or NoSuchElementException. I’m not inside the browser process. Remote or local is mostly where that HTTP call lands.”
They’ll poke capabilities, ChromeOptions, and version skew. Pin browser + driver in CI, or say how your team uses Selenium Manager. Pretending drift never happens is a tell.
Client → binding → driver → browser. Boxes beat buzzwords.
Locators and waits
My order of preference: stable id, clean CSS, XPath when you need axes or text CSS can’t express cleanly. Absolute html/body/div[3]/... paths die on the next redesign. Accessibility-ish queries matter more when the DOM is a mess.
Sleep is not a strategy. Wait on a condition: visible, clickable, child present, text contains. Implicit waits still exist. Mixing a long implicit with explicit waits makes timing weird. Selenium’s docs have warned about that mix for years. I’d keep implicit near zero and use explicit helpers for the real conditions.
Button in the DOM, click still fails?
“Wrong duplicate in a hidden modal? Overlay? Animation? Iframe? Stale after re-render? Wait clickable, scroll into view if needed. JS click last, and I’d say out loud that it’s papering over UX.”
StaleElementReferenceException means the node you held got replaced. Re-find. Don’t cache WebElements across navigations.
Page Object Model, without the cult
POM still wins most rooms: locators in one place, tests read like user steps.
Don’t dump every assertion into HomePage. One meaningful action or query per method. Return the next page after a nav when the flow is linear. Shared header as a component beats copy-paste. Screenplay or plain helpers are fine if you can name the trade-off.
Spoken design I’d use: “LoginPage owns username, password, submit. loginAs(user) fills, clicks, returns InventoryPage. InventoryPage has addItem(name) and cartCount(). Tests never touch CSS. Button id changes once.”
Page classes hold locators. Tests speak in user steps.
If a method name needs a paragraph of comments to explain, it’s doing too much. Split it.
Tests call pages. Pages talk to WebDriver. Locators stay out of the test body.
Grid, parallel, CI
Local Chrome demos well. CI wants isolation.
Grid (or a cloud grid) hands out remote sessions by capability. Parallelism lives in TestNG, JUnit, pytest-xdist, whatever you run. One static WebDriver for the suite will fight itself the second two tests open.
I’d mention ephemeral browsers per shard, unique data or cleanup, video only on failure, quarantine for known flakes instead of silent ignore.
Parallel collisions? “Separate users when the app allows. Or unique emails and tear-down. No shared cart. Driver per thread. If the app can’t isolate, I cut UI parallelism for that slice and push checks to API.”
Flaky tests (they will ask)
Flakes train people to ignore red.
Fix the loud offenders before you add more UI coverage. Races without a real wait. Animations. Third-party widgets. Leftover data. Toast covering the click.
STAR shape (fictional numbers):
- S: Nightly login failed about a third of the time after a cookie banner shipped.
- T: Kill the false reds without sleeping five seconds everywhere.
- A: Traced it. Waited for banner accept or absence. Made accept idempotent. Quarantined one partner-widget case with a ticket.
- R: Login flake rate under 2% over two weeks. Partner test stayed quarantined, not forgotten.
Steal the shape. Use your numbers.
Practice the flaky story out loud. Sleep is not a strategy.
Interviewers can smell a sleep-shaped fix from across the table. Own the condition you waited on.
Condition-based waits. Sleep needs a written reason.
Coding and framework scraps
Small prompts still show up: reverse a string, parse a log, stub a page object in Java or Python.
Framework ask: three-page flow, where config lives, how failures screenshot. Base setup/teardown. Env for URLs. Smoke vs full tags. Don’t claim 100% UI. Push business rules down.
A tiny coding moment they spring on you
Sometimes it’s not WebDriver at all. “Here’s a list of timestamps from a flake log. Count how often each test name failed.” Or “write a retry helper that stops after three tries.”
Talk before you type. Edge cases out loud: empty list, null name, already-passing test. In Java, watch checked exceptions around sleeps in retry demos. In Python, don’t swallow every Exception.
If they hand you a broken page object, fix the obvious: hard-coded sleep, locator in the test, driver created inside a method that runs twice. Say what you’d add in review comments on a real PR.
FAQ
Selenium or Playwright for greenfield? I’d lean Playwright for auto-wait and tracing on a new web app. Keep Selenium when the suite, Grid, or team depth is already there. Trade-offs, not a holy war.
Need Grid for every role? If the JD says CI, parallel, or farms, know the idea. Local homework apps rarely care.
TestNG required? No. Know your runner’s parallel knobs.
Memorize every ExpectedConditions helper? Know the common ones. Write a custom condition if asked. Freezing looks worse than “I’d check the docs for the rare one.”
Mobile? Appium is a sibling chat. Mention it if the JD says mobile.
What I’d drill the night before
Timer on. No slides.
- WebDriver path in under a minute, no Wikipedia voice
- One locator ranking with a reason you’d ditch absolute XPath
- Explicit wait example for a spinner that covers a button
- POM sketch: two pages, one shared header component
- Flaky story with a real fix, not “we restarted Jenkins”
- One sentence on how you’d isolate data for parallel runs
If the JD lists Playwright too, prep the trade-off honestly. Interviewers smell tool fanboys. They like people who inherited a Selenium Grid and still shipped.
Behavioral still sneaks in. Keep a STAR ready for a release you blocked or a flake you finally killed. Pair with SDET interview questions if the loop mixes strategy rounds.
Practicing with OfferBull
Flashcards don’t train the pause before “sleep.”
OfferBull is an AI mock interview app for iOS and Android. Voice interviewer. You speak. Paste a Selenium or SDET JD or upload a resume. Follow-ups on what you said. Suggestions and STAR while you practice. English and Chinese.
Before the interview. Not during.
Practice This Out Loud
Tonight: WebDriver path in 45 seconds. Waits without sleep in 60. One POM sketch. One flaky story under two minutes. Record it. Then a voice mock with follow-ups. → Practice Now