Selenium Interview Questions and Answers
Selenium WebDriver for QA automation: drivers and Selenium Manager, locators, CSS and XPath, waits, exceptions, frames, windows and alerts, the Actions API, page objects and components, Grid 4 and Docker, capabilities, WebDriver BiDi, downloads and uploads, parallel runs, flaky tests and framework design.
225 questions for Selenium interviews with answers and explanations - Junior, Middle and Senior levels. Sample questions, online quizzes and coding tasks.
- Locators
- Waits
- Page Object
- Grid
- BiDi
Questions by level
Junior
Core concepts and syntax · 50 questions
Middle
Practice, nuances and optimization · 50 questions
Senior
Architecture, internals, edge cases · 50 questions
Sample questions
A few questions from each level with the correct answer and an explanation.
Selenium · Junior
- What is Selenium WebDriver?
Show the answer
Correct answer: A library that drives real browsers through a standard protocol
WebDriver sends commands to a browser driver (chromedriver, geckodriver) using the W3C WebDriver protocol. Test runners like JUnit or TestNG run the tests.
- What does a browser driver like chromedriver do?
Show the answer
Correct answer: Translates WebDriver commands into actions in that browser
Each browser has its own driver. Selenium sends HTTP requests to it, and the driver controls the browser.
- What does Selenium Manager (Selenium 4.6+) solve?
Show the answer
Correct answer: It finds or downloads the right driver for the browser automatically
You no longer need to download chromedriver by hand or use a separate WebDriverManager library in most cases.
- How do you open a page in Selenium Java?
Show the answer
Correct answer:
driver.get("https://example.com")get waits for the page load event by default. navigate().to() does the same and keeps history methods like back().
Selenium · Middle
- Why can
@FindByfields withPageFactorycause stale element errors?Show the answer
Correct answer: The proxy may hold an element that was re-rendered after the first lookup
With caching (@CacheLookup) the element is reused even after the DOM changed. Many teams use By locators and find on each call instead.
- What is a page component (or fragment) object?
Show the answer
Correct answer: An object for a reusable part, like a header or table, used by several pages
Components avoid copying the same header locators into every page object.
- Where should the constructor of a page object check that it's on the right page?
Show the answer
Correct answer: It should wait for a key element so wrong navigation fails early
Failing at the right place gives clear errors instead of NoSuchElement three steps later.
- What is the purpose of a driver factory?
Show the answer
Correct answer: Create configured drivers from settings like browser, headless or Grid URL
Tests ask for a driver and don't care how it's built; switching to Grid is a config change.
Selenium · Senior
- What layers does a maintainable Selenium framework usually have?
Show the answer
Correct answer: Tests, business flows, page and component objects, driver and config layers
Each layer changes for its own reasons: UI changes hit pages, business rules hit flows, infrastructure hits driver and config.
- Why is classic WebDriver slower per action than tools using CDP or BiDi directly?
Show the answer
Correct answer: Each command is a separate HTTP round trip to the driver
On a remote Grid every findElement and click pays network latency. Fewer, coarser commands and BiDi help.
- A suite on a remote Grid is twice as slow as locally. What is a likely cause?
Show the answer
Correct answer: Network latency multiplied by thousands of fine-grained commands
Move runners close to the Grid, cut chatty helpers like repeated isDisplayed polling, and parallelize.
- How should a team decide which browsers to run in CI?
Show the answer
Correct answer: Use real user analytics, with full runs on main browsers and smoke on others
Cross-browser cost grows fast. Focus depth where users are and cover the rest with smoke tests.
Coding tasks
Write your solution right in the browser, and tests check it instantly. JavaScript interview classics (debounce, deepClone, Promise.all, an LRU cache), TypeScript tasks on generics, narrowing and utility types checked by the real compiler, Node.js backend logic (middleware, rate limiters, job queues), SQL queries in real PostgreSQL, and React components and hooks like a todo list, tabs, useDebounce and useInterval.
Open tasks →