QA Interview
Selenium BiDi Interview Questions for SDET (2026)
Practice these 47 Selenium BiDi interview questions for SDET roles, with answers on events, network interception, browsing contexts, debugging, and design.
19 min read | 4,105 words
TL;DR
Selenium BiDi adds a persistent, standards-based two-way channel to WebDriver so tests can receive browser events and issue supported browser-level commands. Strong SDET answers cover subscriptions, context scope, event correlation, cleanup, portability, and secure diagnostics.
Key Takeaways
- Describe BiDi as a standards-based, full-duplex event and command protocol that complements classic WebDriver.
- Subscribe before the triggering action and synchronize on filtered events instead of using fixed sleeps.
- Scope listeners by context and intent, remove them reliably, and isolate event state in parallel runs.
- Distinguish passive network observation from interception that can alter browser timing and behavior.
- Prefer standardized BiDi features, with contained CDP fallbacks only when required capabilities are missing.
- Redact secrets and limit event artifacts before publishing browser telemetry in CI.
Selenium BiDi interview questions for SDET roles test whether you understand browser automation beyond element commands. A strong candidate can explain the bidirectional transport, choose event subscriptions deliberately, and design reliable tests around console, network, script, browsing-context, and permission events.
This guide gives you model answers at junior, senior, and framework-design depth. Use it with the Selenium WebDriver interview question guide, then practice explaining each trade-off aloud in the mock interview workspace.
TL;DR
| Topic | What a strong answer proves |
|---|---|
| Protocol | You distinguish request-response WebDriver commands from persistent BiDi event delivery |
| Sessions | You understand capability negotiation, subscriptions, contexts, and cleanup |
| Network | You can observe traffic, intercept selectively, authenticate, and avoid global test coupling |
| Script and logs | You can capture console output and JavaScript failures with context |
| Architecture | You design listeners, buffers, correlation IDs, and parallel-safe abstractions |
| Migration | You choose standards-based BiDi, Selenium conveniences, or temporary CDP access intentionally |
The core message is simple: WebDriver BiDi keeps the standards-based WebDriver model while adding a persistent two-way channel for browser events and commands. Interviewers care less about memorized method names than about event timing, scope, lifecycle, portability, and evidence-based debugging.
1. Selenium BiDi Foundations
Q: 1. What is WebDriver BiDi?
WebDriver BiDi is the W3C browser automation protocol that adds bidirectional, event-driven communication to WebDriver. A client can send commands while the browser independently emits subscribed events over a persistent connection. That makes network traffic, console activity, JavaScript errors, browsing-context changes, and other browser internals observable without repeatedly polling. Selenium exposes the protocol through language bindings and higher-level convenience APIs.
Q: 2. Why was BiDi added when classic WebDriver already worked?
Classic WebDriver is excellent for user-facing actions such as locating, clicking, typing, and navigation, but its command-response shape does not naturally stream browser events. Modern test diagnostics need to see events that occur between commands, sometimes within milliseconds. BiDi fills that gap while preserving a browser-neutral standards path. It also reduces dependence on vendor-specific debugging protocols for common automation needs.
Q: 3. What does bidirectional mean in this context?
Bidirectional means both peers can initiate messages on the same live transport. The test client sends a command with an identifier, and the remote end later returns the matching result or error. Separately, the browser can publish events at any time after a subscription is active. The client therefore needs asynchronous dispatch, not a simple blocking request loop.
Q: 4. Is Selenium BiDi the same as Chrome DevTools Protocol?
No. CDP is Chromium's debugging protocol and can expose capabilities before they are standardized, while WebDriver BiDi is designed through the W3C for cross-browser automation. Selenium may support both, but code tied to a versioned CDP domain carries Chromium and version-coupling risk. Prefer BiDi for standardized features, and document any temporary CDP fallback with an exit plan.
Q: 5. Does BiDi replace normal WebDriver commands?
It complements them. Continue using WebDriver for semantic browser operations such as finding elements, interacting with controls, switching windows, and evaluating expected page state. Use BiDi where events or browser-level control add value, such as capturing a failed API call that explains a blank widget. A framework that rewrites ordinary UI actions around low-level protocol commands usually becomes harder to maintain.
2. Protocol, Transport, and Capability Negotiation
Q: 6. How does a BiDi-capable session start?
The client creates a normal WebDriver session and requests the WebSocket endpoint through the appropriate capability negotiation. If the remote end supports BiDi, the returned session capabilities include the connection information used by the binding. Selenium then manages message serialization, IDs, pending command futures, and event routing. Framework code should fail clearly or disable BiDi-dependent tests when negotiation does not succeed.
from selenium import webdriver
options = webdriver.ChromeOptions()
options.enable_bidi = True
driver = webdriver.Chrome(options=options)
try:
assert driver.capabilities.get("webSocketUrl")
finally:
driver.quit()
This Selenium 4.46.0 smoke check makes missing negotiation an immediate setup failure.
Q: 7. Why is WebSocket a good transport for BiDi?
A WebSocket stays open and supports full-duplex messages, so the browser does not need a fresh HTTP request to deliver each event. This lowers coordination overhead and allows commands and events to be interleaved. Ordering is meaningful on the connection, although application-level events can still reflect concurrent browser work. A dropped socket must be treated as lost observability, not silently ignored.
Q: 8. What are commands, results, errors, and events?
A command contains an ID, a method name, and parameters. The browser answers that ID with either a result or a protocol error, allowing multiple commands to be in flight. An event has a method and parameters but no command ID because it was not requested as an individual response. Good client code separates command completion from event callbacks before applying domain-specific logic.
Q: 9. What should a test do if the browser does not support a required BiDi feature?
Detect support during setup and express the policy explicitly: skip with a precise reason, run a reduced assertion, or use an approved fallback. Do not catch every exception and report a pass, because that turns absent telemetry into false confidence. Capability checks belong near environment provisioning, while feature checks can guard narrower helpers. CI reports should show which coverage was omitted.
Q: 10. How do protocol modules affect compatibility?
BiDi groups behavior into modules such as session, browsing context, network, script, log, and input. Browsers can implement modules and individual commands at different times, so claiming general “BiDi support” is too vague. Pin tested browser and driver ranges in CI, exercise the exact modules you use, and keep Selenium current. Standards reduce vendor variance, but they do not remove release validation.
3. Events, Subscriptions, and Lifecycle
Q: 11. Why must a listener be registered before the action?
Events are not normally replayed for a listener that arrives late. If navigation triggers a console error and the handler is attached afterward, the relevant message has already passed. Register, confirm the subscription, perform the action, and then await the specific evidence. This ordering is one of the most common scenario questions in a BiDi interview.
Q: 12. What is event subscription scope?
Scope determines which event names and browsing contexts feed a subscriber. A suite may need network responses from one tab, not every request made by every window in the session. Narrow scope reduces memory use, callback contention, and accidental matches. When a binding exposes only broader convenience hooks, filter immediately by context, URL, method, or request identifier.
Q: 13. How should listeners be removed?
Store the registration handle or callback identity, remove it in a guaranteed teardown path, and clear any per-test buffers. Listener cleanup must run after failures and timeouts as well as successful assertions. Otherwise later tests receive duplicate callbacks or stale events, producing order-dependent failures. Closing the driver is the final safety net, not the primary per-test cleanup strategy.
Q: 14. How do you wait for one event without using sleep?
Create a future, promise, latch, queue, or condition before triggering the browser action. In the callback, apply a narrow predicate and complete the waiter only for the intended event. Await it with a bounded timeout and print recent observed events when it expires. This synchronizes on causality rather than guessing how long the browser needs.
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
options = webdriver.ChromeOptions()
options.enable_bidi = True
driver = webdriver.Chrome(options=options)
errors = []
handler = driver.script.add_javascript_error_handler(errors.append)
try:
driver.get("data:text/html,<script>setTimeout(()=>{throw Error('boom')},50)</script>")
error = WebDriverWait(driver, 5).until(lambda _: errors[0] if errors else False)
assert "boom" in error.text
finally:
driver.script.remove_javascript_error_handler(handler)
driver.quit()
The handler exists before the page runs, and the bounded wait ends only when the browser emits the error.
Q: 15. How do you handle a burst of BiDi events safely?
Keep the callback fast and move heavy parsing or artifact writing to a bounded worker queue. Use thread-safe collections because many bindings dispatch asynchronously. Define a retention policy, such as the last 200 relevant events per test, instead of accumulating an entire suite's traffic. Record dropped-event counts if backpressure forces sampling.
from collections import deque
from threading import Lock
recent = deque(maxlen=200)
lock = Lock()
def retain(entry):
with lock:
recent.append(entry)
def snapshot():
with lock:
return list(recent)
This collector bounds memory and copies its state before assertions or artifact writing.
4. Browsing Contexts and Navigation
Q: 16. What is a browsing context?
A browsing context represents an environment in which a document is presented, commonly a top-level tab or window and, where applicable, a child frame. BiDi identifies contexts independently of Selenium's current window selection. Events include context information so a client can attribute activity correctly. Treat context IDs as session-scoped opaque values rather than stable business identifiers.
Q: 17. How is a browsing context different from a WebElement?
A context contains a document and navigation history; a WebElement references a node within a particular document. Navigating can replace the document while the top-level context remains, making old element references stale. That distinction explains why context events can survive a page transition while cached elements cannot. Framework APIs should avoid mixing the two identifier types.
Q: 18. How would you verify that a popup opened?
Subscribe to context-creation events before clicking the control that opens the popup. Correlate the new top-level context with its opener when that metadata is available, then confirm the expected URL or title after navigation completes. Do not assume the newest window handle always belongs to your action when parallel browser activity is possible. Remove the subscription after capturing the target context.
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
driver = webdriver.Chrome()
try:
driver.get("data:text/html,<button id=b onclick='open("about:blank")'>open</button>")
original = driver.current_window_handle
driver.find_element("id", "b").click()
handles = WebDriverWait(driver, 5).until(lambda d: d.window_handles if len(d.window_handles) == 2 else False)
driver.switch_to.window(next(h for h in handles if h != original))
assert driver.current_url == "about:blank"
finally:
driver.quit()
This portable WebDriver check verifies the popup outcome. A BiDi context listener can add opener and timing evidence.
Q: 19. What navigation states matter in BiDi tests?
A navigation can be initiated, redirected, committed to a document, reach interactive readiness, and complete its load while subresources continue independently. Choose the event that matches the product claim: a routing test may care about commit, whereas a visual assertion may require a stable application signal after load. “Page loaded” is not a universal synchronization contract. State the chosen boundary in the helper name.
Q: 20. How do redirects affect correlation?
Redirect hops can produce multiple request and response records for one user navigation. Preserve the navigation or request correlation identifiers exposed by the protocol instead of grouping solely by URL. Record status, location, and timing for each hop. This reveals redirect loops and authentication detours that a final-page assertion would hide.
For broader setup patterns, review the Selenium BiDi automation guide and the Selenium Java framework tutorial.
5. Network Observation and Interception
Q: 21. What can an SDET learn from network events?
Network events expose request URLs, methods, headers, response status, resource types, timing boundaries, and correlation data, subject to browser support and protocol rules. They help prove whether the frontend called the correct service and whether failure occurred before rendering. They are diagnostic evidence, not a replacement for direct API contract tests. Redact credentials and personal data before persisting artifacts.
Q: 22. What is the difference between observing and intercepting traffic?
Observation listens without intentionally pausing or changing the request lifecycle. Interception inserts a decision point where the client may continue, fail, redirect, authenticate, or modify a supported part of traffic. Interception has greater test power and greater risk of changing timing or behavior. Use passive observation for diagnostics unless the scenario specifically requires control.
Q: 23. How would you test a frontend's behavior on a 503 response?
Install a narrowly matched intercept for the target API endpoint before the UI action. Supply or trigger a 503 response using the supported network control, then assert the visible retry or error state and any bounded retry count. Exclude unrelated resources so fonts, analytics, and application bootstrap still behave normally. Finally remove the intercept and verify the same flow against an unmodified response.
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
options = webdriver.ChromeOptions()
options.enable_bidi = True
driver = webdriver.Chrome(options=options)
def fail_health(request):
request.fail_request() if request.url.endswith("/health") else request.continue_request()
handler = driver.network.add_request_handler("before_request", fail_health)
try:
driver.get("data:text/html,<script>fetch('https://example.com/health').catch(()=>document.title='failed')</script>")
WebDriverWait(driver, 5).until(lambda d: d.title == "failed")
finally:
driver.network.remove_request_handler("before_request", handler)
driver.quit()
Every callback branch resolves the paused request exactly once.
Q: 24. How should authentication challenges be handled?
Register an authentication handler before navigating to the protected resource and scope it to the expected origin or challenge. Provide credentials through the binding's supported credential object, never by embedding secrets in the URL or logs. Track how many challenges occurred to catch loops. Source credentials from the CI secret store and unregister the handler during teardown.
import os
from selenium import webdriver
options = webdriver.ChromeOptions()
options.enable_bidi = True
driver = webdriver.Chrome(options=options)
handler = driver.network.add_auth_handler(os.environ.get("BIDI_USER", "admin"), os.environ.get("BIDI_PASSWORD", "admin"))
try:
driver.get("https://the-internet.herokuapp.com/basic_auth")
assert "Congratulations" in driver.page_source
finally:
driver.network.remove_auth_handler(handler)
driver.quit()
The credentials stay outside source control, and teardown removes the handler.
Q: 25. Can BiDi replace a proxy such as mitmproxy or a service virtualizer?
Not completely. BiDi is convenient for in-browser, per-session observation and supported interception, with direct correlation to contexts. A proxy can cover multiple clients, inspect protocols outside browser scope, centralize recording, or model complex downstream systems. Select based on the test boundary, required fidelity, TLS constraints, and operational cost rather than assuming one tool dominates.
Q: 26. How do you avoid flaky network assertions?
Match stable attributes such as normalized path, HTTP method, context, and correlation ID, not incidental ordering across unrelated resources. Start the subscription first, await the exact terminal event, and bound the collection window. Account explicitly for retries, redirects, preflight requests, caching, and service workers. On failure, attach the filtered event timeline so the assertion can be diagnosed.
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
options = webdriver.ChromeOptions()
options.enable_bidi = True
driver = webdriver.Chrome(options=options)
seen = []
def observe(request):
try:
if request.url.startswith("https://www.selenium.dev/"):
seen.append((request.method, request.url))
finally:
request.continue_request()
handler = driver.network.add_request_handler("before_request", observe)
try:
driver.get("https://www.selenium.dev/")
WebDriverWait(driver, 8).until(lambda _: any(method == "GET" for method, _url in seen))
finally:
driver.network.remove_request_handler("before_request", handler)
driver.quit()
The predicate discards unrelated traffic while tolerating nondeterministic resource order.
The Java network events guide and Python request interception tutorial provide language-specific follow-up practice.
6. Script, Console, and Error Diagnostics
Q: 27. How do BiDi script events improve failure diagnosis?
They can surface JavaScript exceptions, console messages, and realm-related execution information close to when the browser produced them. A UI timeout can then be paired with the actual uncaught error rather than reported only as a missing element. Capture context, level, timestamp, source, and stack details when available. Filter known third-party noise through reviewed rules, not a blanket ignore.
Q: 28. What is a JavaScript realm?
A realm is an execution environment with its own global object and values, such as a page's window realm or an isolated sandbox. Values and object handles belong to the realm that created them. Navigation or frame removal can destroy that realm, invalidating handles. Mentioning realm lifecycle shows that you understand why remote JavaScript references cannot be cached indefinitely.
Q: 29. What is the difference between a remote value and a local language object?
A remote value is the protocol's serialized representation of a browser-side JavaScript value. Primitives can usually be copied directly, while objects may be represented structurally or by handles with ownership rules. The Java, Python, or JavaScript binding converts that representation into language-friendly types. Cycles, special numbers, DOM nodes, and large graphs require deliberate serialization choices.
Q: 30. How would you fail a test on severe console errors?
Attach the console or log handler before navigation, collect entries with their context, and apply an allowlist limited to reviewed, specific signatures. After the tested action, assert that no unexpected error-level entries occurred, while still preserving warnings as diagnostics if useful. Avoid failing on every message because browsers and third-party libraries can emit benign noise. Put the filtering policy under version control.
import java.time.Duration;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import org.openqa.selenium.bidi.log.JavascriptLogEntry;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.support.ui.WebDriverWait;
public class ConsoleGate {
public static void main(String[] args) {
ChromeDriver driver = new ChromeDriver(new ChromeOptions().enableBiDi());
List<JavascriptLogEntry> errors = new CopyOnWriteArrayList<>();
long id = driver.script().addJavaScriptErrorHandler(errors::add);
try {
driver.get("data:text/html,<script>throw new Error('checkout crashed')</script>");
new WebDriverWait(driver, Duration.ofSeconds(5)).until(ignored ->
errors.stream().anyMatch(e -> e.getText().contains("checkout crashed")));
if (errors.isEmpty()) throw new AssertionError("Expected JavaScript error");
} finally {
driver.script().removeJavaScriptErrorHandler(id);
driver.quit();
}
}
}
This complete class uses a BiDi-enabled ChromeDriver and Selenium's typed JavascriptLogEntry handler.
Q: 31. Why is console capture better than calling getLog at teardown?
Event capture sees messages as they occur and can associate them with the action, context, and event order. Teardown polling may be unsupported, incomplete, or too late to preserve transient relationships. Streaming also allows a test to await a particular application signal. A final snapshot remains useful as a supplement, but it should not be confused with real-time subscription.
Q: 32. What privacy controls belong in diagnostic capture?
Redact authorization headers, cookies, tokens, user identifiers, query secrets, and sensitive request or response content before logs leave the test process. Apply allowlists for captured bodies and cap payload sizes. Restrict artifact access and retention in CI. Security review is required because better browser observability can accidentally create a more complete record of private data.
See capturing JavaScript errors with Selenium BiDi for focused examples.
7. Reliability, Concurrency, and Framework Design
Q: 33. Where should BiDi code live in a test framework?
Place protocol details in small session-scoped adapters, then expose domain helpers such as awaitFailedCheckoutRequest or collectUnexpectedConsoleErrors. Tests should state intent without manipulating raw event maps. Keep registration lifetime visible and return closeable handles where the language permits. This design contains protocol evolution and makes unit testing the filtering logic straightforward.
Q: 34. How do you make BiDi utilities safe for parallel tests?
Never share a mutable event buffer or driver session across independently executing tests. Key state by session and context, use concurrency-safe primitives, and ensure callback executors cannot leak one test's data into another. Generate artifact names from stable test IDs. Parallel safety should be verified with repeated stress runs, not inferred from passing once.
Q: 35. What should a timeout error contain?
Report the expected event predicate, subscribed event types, target context, elapsed time, and the last relevant events observed. Include whether the connection closed or the subscription failed. Redact sensitive fields while retaining correlation IDs and status codes. “Timed out after 10 seconds” alone discards the evidence BiDi was introduced to provide.
Q: 36. How do you test a BiDi wrapper itself?
Unit-test pure predicates, redaction, correlation, bounded-buffer behavior, and event-to-domain mapping with representative protocol objects. Add integration tests against supported browser versions for subscription timing and cleanup. Include negative tests for no matching event, connection loss, duplicate events, and context destruction. Keep raw fixtures minimal so protocol schema changes are visible during upgrades.
Q: 37. How should event artifacts be attached to CI reports?
Write a compact chronological JSON artifact per failed test, plus a human-readable summary that highlights errors, failed responses, and navigations. Preserve raw timestamps and correlation IDs for deeper analysis. Enforce size limits and secret redaction before upload. Link the artifact from the test result rather than dumping thousands of events into console output.
8. Cross-Browser Strategy and Migration from CDP
Q: 38. When would you still use CDP?
Use CDP when a required Chromium-specific capability has no suitable WebDriver BiDi equivalent and the product risk justifies browser-specific coverage. Hide it behind an interface, mark the supported browser range, and track the standards or Selenium issue that would allow removal. Do not mix raw CDP calls throughout tests. The fallback should be a conscious compatibility decision.
Q: 39. How would you migrate a CDP-based listener to BiDi?
Inventory the exact CDP domains, event fields, filters, and downstream assertions first. Map only supported semantics to BiDi, because similar names do not guarantee identical timing or payload shape. Run old and new collectors side by side in a non-blocking comparison period, then switch assertions after discrepancies are understood. Remove version-specific CDP dependencies when the migration is proven.
Q: 40. Does standardization guarantee identical browser behavior?
It defines interoperable semantics and conformance expectations, but implementations can differ in completeness, bugs, release timing, and browser architecture. Maintain a browser capability matrix based on automated contract tests. File minimized reproductions when behavior diverges. Avoid encoding vendor quirks into product assertions unless the product genuinely has browser-specific requirements.
Q: 41. What should a cross-browser BiDi smoke suite cover?
Test session negotiation, one scoped subscription, event receipt after a controlled action, listener removal, and clean session shutdown. Add one representative contract for each module your framework depends on, such as a known console message and a known network response. Keep these tests independent of the main product when possible. They distinguish infrastructure incompatibility from an application regression.
9. Scenario-Based Selenium BiDi Interview Questions for SDET
Q: 42. A network event is visible locally but missing in CI. What do you investigate?
Check browser, driver, Selenium, and Grid versions first, then confirm that the remote session actually negotiated BiDi. Verify listener registration completes before navigation and that the CI route is not served from cache or a service worker. Compare context filters and proxy behavior. Capture connection closure, subscription errors, and a minimal event trace instead of increasing sleep duration.
Q: 43. Your listener fires twice after several tests. What is the likely defect?
The framework is probably registering a new callback per test without removing the old one, or retry setup is duplicating registration. Inspect listener counts and bind each registration to a closeable per-test scope. Make teardown idempotent so a partial setup can still clean up safely. A static driver or singleton collector often makes this failure worse.
Q: 44. A test intercepts every image and becomes slow. How do you redesign it?
Move filtering as close to the protocol subscription or intercept declaration as the API permits. Match the specific origin, path pattern, resource type, and context required by the scenario. Continue unmatched traffic immediately and avoid synchronous file or JSON work in callbacks. Measure queue depth and intercepted request count to confirm the change addresses the actual bottleneck.
Q: 45. A console-error gate suddenly fails hundreds of tests. How do you respond?
Group failures by normalized message, source, browser version, and application release to find the dominant signature. Determine whether it is a real shared regression, a third-party script change, or a browser implementation change. Quarantine only a precise, time-bounded signature if release policy permits, with an owner and issue link. Do not weaken the gate globally to restore green CI.
Q: 46. How would you debug an iframe payment failure with BiDi?
Track browsing contexts so events from the payment frame are separated from the top-level page. Observe requests to the payment origin, authentication or policy failures, and console exceptions without logging cardholder data. Correlate the failed response with the frame context and the user's submit action. Respect cross-origin and security constraints rather than trying to extract protected DOM content.
Q: 47. Design a reusable wait for a specific API response.
Accept a session, context, normalized request predicate, expected terminal condition, and timeout. Register before the triggering action, correlate request and response by protocol identifiers, and complete exactly once while tolerating unrelated traffic. Return a typed summary rather than the entire mutable event object. On timeout, include matched partial requests and always unsubscribe in a finally or close method.
10. How Interviewers Grade Your Answers
Interviewers usually score four layers. First, define the concept accurately: BiDi is a standards-based, persistent, event-capable extension to WebDriver, not a Selenium synonym for CDP. Second, explain lifecycle: negotiate support, subscribe before the action, filter, await deterministically, and clean up.
Third, connect the feature to a credible test outcome. For example, a network listener is useful because it can prove the checkout UI called the correct endpoint and preserve the failed status that explains an error screen. Fourth, discuss engineering constraints such as cross-browser support, parallel isolation, redaction, timeouts, and migration.
For scenario questions, narrate diagnosis in evidence order. State what you would inspect, what observation would confirm or reject the hypothesis, and how you would leave the framework safer. Senior candidates also separate product assertions from diagnostic telemetry and explain when a proxy, direct API test, CDP fallback, or ordinary WebDriver command is the better tool.
Use the automation testing interview collection and core Java questions for Selenium testers to round out protocol knowledge with broader SDET fundamentals. You can also upload your resume to the QAJobFit resume analyzer and check whether BiDi skills are supported by concrete project evidence.
Common Mistakes
- Calling BiDi “CDP inside Selenium.” The protocols have different governance, portability goals, and schemas.
- Registering a handler after navigation or clicking, then adding arbitrary sleeps when the event is missed.
- Collecting every event for an entire suite without context filters, limits, redaction, or cleanup.
- Treating network observation as proof of backend correctness while skipping direct API and contract testing.
- Sharing listeners, buffers, or driver sessions across parallel tests.
- Matching only a URL string and ignoring method, redirects, retries, preflight, cache, and service workers.
- Failing on every console warning without a reviewed noise policy.
- Hiding unsupported features behind catch-all exception handling.
- Persisting cookies, tokens, credentials, or sensitive bodies in CI artifacts.
- Reciting method names without explaining subscription timing, correlation, and teardown.
- Replacing stable WebDriver element operations with unnecessary low-level protocol commands.
- Assuming one successful Chromium run proves Firefox and other target-browser compatibility.
Conclusion: Selenium BiDi Interview Questions for SDET
These Selenium BiDi interview questions for SDET candidates center on one engineering skill: turning asynchronous browser telemetry into deterministic, portable test evidence. Learn the protocol model, then practice explaining event timing, context scope, correlation, cleanup, privacy, and failure diagnostics through concrete scenarios.
Build one small exercise that captures a console error and one that awaits a chosen network response. Bring the resulting architecture decisions to the interview, because a clear trade-off backed by working evidence is stronger than a list of memorized APIs.
Interview Questions and Answers
What problem does WebDriver BiDi solve?
Classic WebDriver is primarily command-response, so it does not naturally stream browser activity that occurs between commands. BiDi adds a persistent two-way channel for subscribed events and supported commands. This enables standards-oriented network, log, script, and context observability.
How is WebDriver BiDi different from CDP?
WebDriver BiDi is a W3C protocol intended for interoperable browser automation. CDP is Chromium's debugging protocol and often exposes Chromium-specific features sooner. I prefer BiDi for standardized coverage and isolate CDP only when a required feature has no suitable alternative.
Why do you subscribe before triggering the UI action?
An event can occur immediately and is not normally replayed to a late listener. I complete the subscription, trigger the action, and await a narrowly filtered event with a timeout. Teardown removes the listener even if the assertion fails.
How do you prevent BiDi listeners from causing flaky tests?
I scope by session, context, and stable event attributes, then use a future or queue instead of sleep. Each registration has deterministic cleanup, and buffers are bounded. Timeout messages include recent relevant events and connection state.
What is a browsing context in BiDi?
A browsing context is an environment that presents a document, such as a top-level tab or a child frame. Its protocol identifier lets events be attributed without relying only on Selenium's currently selected window. Navigation may replace the document while the top-level context remains.
When would you intercept rather than observe network traffic?
I observe traffic for diagnostics because it minimizes test interference. I intercept only when the scenario needs control, such as forcing a selected API to return 503 or handling an authentication challenge. The match is narrow and the intercept is removed after the test.
How do you make BiDi utilities parallel-safe?
I keep drivers, listener registrations, buffers, and artifacts session-scoped. State is keyed by test and context, and asynchronous callbacks use concurrency-safe structures. No mutable collector is shared across unrelated tests.
What should happen when a required BiDi module is unsupported?
Setup should detect the missing capability and apply an explicit policy, such as a clearly reported skip or approved fallback. Catching the error and passing would hide lost coverage. The CI capability matrix records which browser versions support each required contract.
How would you migrate network logging from CDP to BiDi?
I inventory the CDP fields and assertion semantics, map supported behavior to BiDi, and compare both collectors on representative runs. Differences in event timing, redirects, and payloads are resolved before switching assertions. Then I remove the version-specific dependency and retain contract tests.
How do you secure BiDi diagnostic artifacts?
I redact authorization data, cookies, tokens, user identifiers, and sensitive bodies before persistence. Capture uses allowlists and size caps, and CI limits artifact access and retention. Raw observability is never allowed to bypass the project's data-handling policy.
Frequently Asked Questions
What is Selenium WebDriver BiDi?
WebDriver BiDi is the W3C bidirectional browser automation protocol exposed through Selenium bindings. It lets a test issue commands and receive subscribed browser events over a persistent connection.
Is Selenium BiDi the same as Chrome DevTools Protocol?
No. CDP is Chromium's debugging protocol, while WebDriver BiDi is designed for cross-browser standardization. Selenium can support both, but portable framework code should favor an adequate BiDi feature.
Does WebDriver BiDi replace Selenium WebDriver?
No. BiDi complements WebDriver's element interactions and navigation commands with event streaming and browser-level capabilities. Most real suites use both through the same Selenium session.
Why must BiDi listeners be registered before an action?
The browser emits events when they happen and generally does not replay them for late subscribers. Registering first prevents a fast navigation, request, or console error from being missed.
Can Selenium BiDi intercept network requests?
Supported BiDi network capabilities can observe traffic and control selected intercepted requests. Exact commands and convenience APIs depend on the Selenium binding, browser implementation, and versions under test.
How should SDETs prepare for Selenium BiDi interviews?
Learn the protocol model, subscription lifecycle, browsing contexts, network correlation, script diagnostics, and BiDi versus CDP trade-offs. Practice scenario answers that include setup timing, filters, timeout evidence, cleanup, and cross-browser validation.
Related Guides
- SDET Coding Interview Questions for Testers (2026)
- Selenium Interview Questions for 1 Years Experience (2026)
- Selenium Interview Questions for 10 Years Experience (2026)
- Selenium Interview Questions for 2 Years Experience (2026)
- Selenium Interview Questions for 3 Years Experience (2026)
- Selenium Interview Questions for 4 Years Experience (2026)