Advanced Selenium Interview Questions (2027)

46 advanced Selenium interview questions on W3C WebDriver, BiDi vs CDP, Selenium Manager, Grid 4 architecture, scaling in CI and failure scenarios.

Sep 27, 2025 - 17:39
Nov 8, 2026 - 10:56
 0  114
Advanced Selenium Interview Questions (2027)

Advanced Selenium interview questions test how well you understand what happens below your test code: the W3C WebDriver protocol, WebDriver BiDi and the Chrome DevTools Protocol, Selenium Manager, the Grid 4 components, wait and session internals, and how to keep a large suite fast and stable in CI. This page has 46 questions on those internals.

It is written for testers and SDETs with a few years of Selenium behind them. If you need the basics first, start with our 100+ Selenium interview questions. For framework design questions, read the real-time Selenium framework guide, and for "what would you do if" rounds, our main scenario-based Selenium interview questions page is the one to practise with. This page stays on protocol, browser and Grid internals so it does not repeat those three.

Key takeaways

  • Selenium 4 speaks the W3C WebDriver standard. The old JSON Wire Protocol is gone, so capabilities must use W3C names or a vendor prefix such as goog:chromeOptions.
  • WebDriver BiDi is the W3C bidirectional protocol that Selenium is moving to. Selenium's documentation calls its CDP support temporary until BiDi is implemented.
  • Selenium Manager ships with Selenium and finds or downloads the right browser driver, so most projects no longer need WebDriverManager or a driver on the PATH.
  • Grid 4 is split into router, distributor, session map, session queue, event bus and nodes. Senior candidates are expected to explain each part.
  • Flaky tests are usually a synchronisation or data problem. Interviewers want you to talk about explicit waits, test isolation and stable locators before retries.

How the questions are organised

SectionQuestionsWhat it checks
Foundations advanced rounds still probe1 to 10Protocol, sessions, waits, locators
2 to 5 years: Selenium 4 features11 to 24BiDi, CDP, Selenium Manager, relative locators, new windows, shadow DOM
Senior: Grid, scale and CI25 to 38Grid 4 components, Docker, Kubernetes, parallelism, observability
Scenario questions39 to 46Diagnosing failures at the protocol and Grid level

Foundations that advanced rounds still probe

1. What happens on the wire when you call driver.findElement()?

The client library sends an HTTP POST to the driver's /session/{session id}/element endpoint with a locator strategy and value. The driver (chromedriver, geckodriver and so on) finds the element in the browser and returns a JSON object containing a web element reference. Later calls such as click send that reference back to endpoints like /element/{element id}/click.

2. What changed when Selenium moved fully to the W3C WebDriver standard?

Selenium 4 removed the JSON Wire Protocol handshake. Every client, driver and Grid now speaks the W3C protocol defined by the WebDriver specification. In practice you must use standard capability names (browserName, browserVersion, platformName, pageLoadStrategy, timeouts) and put anything browser-specific under a vendor prefix such as goog:chromeOptions or moz:firefoxOptions. DesiredCapabilities gave way to typed options classes like ChromeOptions.

3. Which locator strategies does the W3C spec define?

Five: CSS selector, link text, partial link text, tag name and XPath. Selenium's By.id, By.name and By.className are converted to CSS selectors by the client before the request goes out, which is why an ID containing special characters can fail in surprising ways.

4. Why does mixing implicit and explicit waits cause trouble?

The implicit wait is applied by the driver to every element lookup, while an explicit wait polls from the client. When both are set, each poll inside WebDriverWait can block for the full implicit timeout, so a 10 second explicit wait with a 10 second implicit wait can take far longer than expected. Selenium's documentation warns against mixing them. Pick explicit waits and keep the implicit wait at zero.

5. What is a StaleElementReferenceException at the protocol level?

The driver returns "stale element reference" when the element behind a reference is no longer attached to the document, usually because the page or a framework re-rendered that part of the DOM. The fix is to locate the element again after the change, or wait for the new element, not to catch and ignore the exception.

6. What does pageLoadStrategy control?

It tells the driver when a navigation command returns. normal waits for the load event, eager returns when the DOM is ready (DOMContentLoaded), and none returns right after the initial page is received. Eager can speed up suites on heavy pages, but you then own every wait for content that loads later.

7. Which timeouts can a W3C session set?

Three: script (asynchronous and synchronous script execution), pageLoad (navigation) and implicit (element lookup). They are sent as the timeouts capability or set on a running session.

8. How do Actions work under the W3C protocol?

The Actions API builds input source sequences (key, pointer, wheel) that are sent together to the driver's actions endpoint. The driver runs them tick by tick, which is how chords such as Shift plus click or drag-and-drop paths are reproduced. Calling perform() sends the sequence; releaseActions clears pressed keys and buttons.

9. When is executeScript a reasonable choice and when is it a smell?

It is reasonable for reading state the UI does not expose, scrolling a container, or setting up test data through an app's own API. It is a smell when it replaces user actions, such as clicking a hidden button with JavaScript, because the test then passes in cases where a real user would be blocked.

10. How do you design locators that survive UI changes?

Ask developers for dedicated test attributes such as data-testid, prefer short CSS selectors over long absolute XPath, and avoid generated class names from CSS-in-JS tools. Keep locators in one place (a page object or component object) so a change touches one file.

Selenium 4 features (2 to 5 years of experience)

11. What is WebDriver BiDi and why does it matter?

WebDriver BiDi is a W3C protocol that adds a two-way WebSocket channel between the client and the browser. Classic WebDriver is request and response only, so it cannot push events such as console messages or network activity. BiDi can, and it is designed to work across browsers. You enable it with the webSocketUrl capability.

12. How is BiDi different from the Chrome DevTools Protocol?

CDP is Chromium's internal debugging protocol. It changes between browser versions and only works in Chromium-based browsers. BiDi is a standard written with browser vendors and intended to work in Chrome, Edge and Firefox. Selenium's documentation describes its CDP support as temporary until BiDi covers the same ground.

13. What can you do with BiDi today that Classic WebDriver cannot?

Listen for browser console and JavaScript errors as they happen, observe or intercept network requests, and react to browsing context events. Coverage differs by language binding and browser, so check the Selenium BiDi documentation for your binding before promising a feature in an interview.

14. What does Selenium Manager do?

Selenium Manager is a command line tool bundled with Selenium. When you create a driver without a driver path, it detects the installed browser, downloads a matching driver if needed and caches it. It can also fetch a browser build such as Chrome for Testing. This removes most "driver version does not match browser" failures.

15. When would you still pin a driver path instead of using Selenium Manager?

In locked-down networks where build agents cannot download files, in air-gapped environments, or when you bake an exact browser and driver into a container image for repeatable builds. In those cases set the driver path or use a prepared image.

16. What are relative locators?

Selenium 4 added RelativeLocator.with() so you can find an element above, below, toLeftOf, toRightOf or near another element. They work from element positions on the rendered page, so responsive layouts can change the result. Use them when a field has no stable attribute but a nearby label does.

17. How do you open a new tab or window in Selenium 4?

Call driver.switchTo().newWindow(WindowType.TAB) or WindowType.WINDOW. The driver opens it and switches to it in one step, which replaces the old trick of sending keyboard shortcuts or running window.open.

18. How do you find elements inside a shadow DOM?

Get the host element, call getShadowRoot(), then search inside the returned shadow root with a CSS selector. XPath does not work inside a shadow root in this API, so plan for CSS selectors when testing web components.

19. How do you take a screenshot of one element or a full page?

WebElement.getScreenshotAs() captures a single element in every driver. Full-page screenshots are a Firefox feature exposed through FirefoxDriver.getFullPageScreenshotAs(); in Chromium you need CDP or stitching.

20. How do you print a page to PDF?

Selenium 4 exposes the W3C Print command through PrintsPage and PrintOptions, which returns the PDF as Base64. Chrome needs headless mode for printing.

21. How does the virtual authenticator help with WebAuthn testing?

The W3C virtual authenticator lets a test add a fake security key or platform authenticator to the browser, register credentials and sign in, without real hardware. It is the supported way to automate passkey and WebAuthn flows.

22. What changed with headless Chrome?

Chrome replaced the old separate headless implementation with a headless mode that runs the same browser code as headed Chrome, enabled with --headless=new and later the default for --headless. Selenium removed its setHeadless() helper, so you pass the argument yourself.

23. How do you capture browser logs reliably across browsers?

The old logging endpoint was never part of the W3C standard and only some drivers support it. The portable route is BiDi log events; the Chromium-only route is CDP. Many teams also attach network and console output from the application side.

24. How do Selenium 4 options classes help with cross-browser code?

Each browser has a typed options class (ChromeOptions, EdgeOptions, FirefoxOptions, SafariOptions) extending a common base. A factory can build the right options from configuration and pass them to a local driver or a RemoteWebDriver without casting maps by hand.

Senior: Grid, scale and CI

25. What are the components of Selenium Grid 4?

The router (entry point for all requests), distributor (assigns new sessions to nodes), session map (maps session IDs to nodes), new session queue (holds requests until a slot is free), event bus (messaging between components) and nodes (run the browsers). Standalone mode runs all of them in one process; hub and node mode groups everything except nodes into the hub; fully distributed mode runs each separately.

26. When would you run Grid in fully distributed mode?

When one hub process becomes a bottleneck or a single point of failure, or when you need to scale the router independently. For most teams standalone or hub and node is easier to run and debug.

27. How do you run Grid in containers?

The SeleniumHQ docker-selenium project publishes images for the hub, nodes, standalone browsers and the separate components. A Compose file can start a hub and a node per browser. The project also publishes a Helm chart for Kubernetes.

services:
  selenium-hub:
    image: selenium/hub
    ports:
      - "4442:4442"
      - "4443:4443"
      - "4444:4444"
  chrome:
    image: selenium/node-chrome
    shm_size: 2gb
    depends_on:
      - selenium-hub
    environment:
      - SE_EVENT_BUS_HOST=selenium-hub
      - SE_EVENT_BUS_PUBLISH_PORT=4442
      - SE_EVENT_BUS_SUBSCRIBE_PORT=4443

Pin image tags in real projects. Port 4444 serves the Grid, 4442 and 4443 are the event bus publish and subscribe ports.

28. How do you autoscale Grid on Kubernetes?

The docker-selenium Helm chart can integrate with KEDA, which reads the Grid's session queue and scales browser node deployments or jobs up and down. Scaling on queue length tracks demand better than CPU, because an idle browser uses little CPU but still holds a slot.

29. Why does /dev/shm size matter for browser containers?

Chromium uses shared memory heavily. Docker's default /dev/shm is small, which leads to tab crashes under load. Set shm_size (2 GB is the value used in the docker-selenium examples) or mount the host's shared memory.

30. How do you see what Grid is doing?

Grid 4 has a web UI and a GraphQL endpoint at /graphql that reports nodes, slots and queued sessions. It can also emit OpenTelemetry traces, so you can follow a single command from the router through the node in Jaeger or another tracing backend.

31. How do you control session timeouts on Grid?

Node flags such as --session-timeout end sessions that have been idle too long, and the new session queue has its own request timeout. Without them, a test that crashes before quit() holds a browser slot until the node restarts.

32. How do you decide the right level of parallelism?

Start from the slowest resource: browser slots, the application under test, or test data. Run a few suite sizes, measure total time and failure rate, and stop increasing threads when failures rise or time stops falling. More threads against a shared test environment often makes results worse.

33. How do you keep parallel tests independent?

Use one driver per thread (for example a ThreadLocal in Java), create test data per test rather than sharing accounts, avoid static state in page objects, and make every test able to run alone in any order.

34. How do you run Selenium tests in a CI pipeline without slowing every merge?

Split suites by purpose: a short smoke set on every merge request, the full regression on a schedule or before release. Run browsers in containers next to the job, publish JUnit XML so the CI server shows failures, and keep screenshots and logs as artifacts. Our guide to CI/CD pipeline examples shows where UI tests usually sit in a pipeline.

35. What would you collect when a UI test fails in CI?

A screenshot, the page source, browser console output, the driver log, the Grid session ID and node name, and the application request ID if the app returns one. With those you can usually tell a test bug from an app bug without rerunning.

36. When should a test be moved out of Selenium?

When it checks business rules that an API or unit test can cover. UI tests are slow and costly to maintain, so keep them for user journeys and integration between the browser and backend.

37. How do you handle file downloads on a remote Grid?

Set the se:downloadsEnabled capability. Grid 4 then lets the client list and fetch files downloaded on the node through the HasDownloads API, so the test can verify the file without shared storage.

38. How do you treat retries in a mature suite?

Allow at most one automatic retry, record every retry, and review tests that needed one. A retry hides the cost of flakiness; the report makes it visible so the root cause gets fixed.

Scenario questions

39. Tests pass locally but fail on Grid with "session not created". What do you check?

Compare the requested capabilities with what the nodes offer: browser name, version and platform. Check the Grid UI for free slots and the session queue for timed-out requests. A vendor-prefixed option that a node's driver does not understand also causes this error.

40. After a Chrome auto-update, every test fails at startup. How do you fix it and stop it recurring?

The driver and browser versions no longer match. Let Selenium Manager resolve the driver, or rebuild the container image with matching versions. To stop it recurring, pin browser versions in CI images and upgrade them deliberately.

41. Clicks fail with "element click intercepted". What is happening?

Another element covers the target at the click point: a cookie banner, a spinner overlay or a sticky header. Wait for the overlay to disappear or close it, scroll the element into view, and check the window size in headless runs, since the default may be smaller than your desktop.

42. Your suite grew from 20 to 60 minutes. Where do you look first?

Find the slowest tests and the most common waits. Look for fixed sleeps, implicit waits mixed with explicit ones, login through the UI in every test, and setup data created through the browser. Replace UI setup with API calls and cache authenticated sessions where the app allows it.

43. You need to assert that no JavaScript errors occur on a checkout page. How?

Subscribe to BiDi log events (or CDP on Chromium) before navigation, collect errors during the flow, and fail the test if any appear. Keep an allow list for known third-party noise so the check stays useful.

44. Grid nodes slowly run out of memory over a day. What do you suspect?

Sessions that were never closed. Check that every test calls quit() in a finally block or teardown hook, set node session timeouts, and recycle browser containers after a fixed number of sessions.

45. A test needs to mock a slow third-party API in the browser. What are your options?

Use BiDi or CDP network interception to return a fixed response, point the app at a stub server in the test environment, or use a feature flag that switches the integration off. The stub server is the most portable because it does not depend on browser protocol support.

46. Security asks you to stop storing test passwords in the framework. What do you change?

Move secrets into the CI system's secret store or a vault, inject them as environment variables at runtime, mask them in logs, and make sure screenshots and page source attachments do not capture them.

How to practise these questions

Run a local Grid with Docker Compose, point a small suite at it and open the Grid UI while tests run. Then turn on BiDi for one test and print console events. Being able to say "I have done this" about both is worth more than memorising answers. If you are building toward a DevOps or SDET role, our DevOps training in Pune covers CI pipelines, Docker and Kubernetes around test automation, and the Jenkins course covers running test stages in pipelines. More interview topics are in the 200+ DevOps interview questions guide.

Frequently asked questions

What counts as an advanced Selenium interview question?

Questions about how Selenium works underneath your code: the W3C protocol, BiDi and CDP, Grid architecture, wait internals and scaling suites in CI. Basic rounds ask how to use the API; advanced rounds ask why it behaves the way it does.

Do I still need WebDriverManager with Selenium 4?

Usually not. Selenium Manager is bundled with Selenium and resolves drivers automatically. You may still pin drivers in offline or locked-down build environments.

Should I learn CDP or WebDriver BiDi?

Learn BiDi first because it is the W3C standard Selenium is moving to and works across browsers. Know what CDP is, since some Chromium-only features still rely on it.

Which Grid mode should I describe in an interview?

Explain all three: standalone, hub and node, and fully distributed. Then say which you would choose for your team size and why.

How many automatic retries are acceptable?

Most teams allow one at most and report every retry so flaky tests get fixed rather than hidden.

Is Selenium still worth learning for DevOps roles?

Yes. It is a W3C-standard browser automation project with a large user base, and UI tests still need to run in CI pipelines that DevOps engineers build and maintain.

Official references

What's Your Reaction?

Like Like 0
Dislike Dislike 0
Love Love 0
Funny Funny 0
Angry Angry 0
Sad Sad 0
Wow Wow 0
Mridul I am a passionate technology enthusiast with a strong focus on DevOps, Cloud Computing, and Cybersecurity. Through my blogs at DevOps Training Institute, I aim to simplify complex concepts and share practical insights for learners and professionals. My goal is to empower readers with knowledge, hands-on tips, and industry best practices to stay ahead in the ever-evolving world of DevOps.