WebDriver Architecture
How a Selenium client actually drives a browser: the HTTP contract it speaks, how a session opens and closes, and where the driver binary comes from. Interviewers probe it for depth past the API.
on this pageshowhide
explore
- The HTTP Contract17 questions
- Command Endpoints5 questions
- Element Identifiers4 questions
- Capability Negotiation3 questions
- BiDi Event Modules5 questions
- Opening and Closing Sessions16 questions
- Launching a Browser4 questions
- Browser Options Objects4 questions
- Driver Service Processes5 questions
- Quitting and Cleanup3 questions
- Binary Provisioning7 questions
- Automatic Driver Setup4 questions
- Version Alignment Drift3 questions
questions
page 2 of 2In Selenium 4, how do the error, message and stacktrace members of a failed command help you locate the fault?
basics
~10 sThe error member is a fixed code the client maps onto an exception type, the message is the driver's text naming the specifics, and the stacktrace comes from the remote end, not your test.
In Selenium, what profile does a Chrome session use by default, and what changes when ChromeOptions adds --user-data-dir?
basics
~20 sBy default the driver creates a throwaway user-data directory per session, so every run starts with no cookies, extensions or history. Adding --user-data-dir points Chrome at a directory you keep, carrying state in and writing it back out.
What changes when a Selenium suite swaps new ChromeDriver() for RemoteWebDriver against a URL?
basics
~20 sOnly construction changes. The remote form starts no process locally, takes a reachable URL plus capabilities naming the browser, and makes every command a network round-trip. The command set, the session id and the test code stay identical.
A Selenium suite leaves chromedriver processes and temp profile directories on the CI agent - what causes that and how do you fix it?
basics
~20 sEach leftover process is a session that was never deleted. In Selenium 4 only quit() sends Delete Session and stops the driver executable the client launched, so close-only teardown and killed runs leave both behind.
In Selenium 4, how do you decide which capabilities belong in alwaysMatch and which belong in firstMatch?
basics
~10 sPut in alwaysMatch only what a result would be meaningless without, and use firstMatch for preferences you would rather degrade than fail on. Every extra requirement trades a chance of no session for reproducibility.
On a long-lived shared runner, how far do you go beyond driver.quit() to stop Selenium sessions accumulating?
basics
~20 sMake quit() unconditional first, then add one bounded backstop for the runs where it cannot execute: a scoped pre-run sweep, a disposable run environment, or moving browsers to a remote end that reaps its own abandoned sessions.
In Selenium, what does a started ChromeDriverService's getUrl() return, and what is it used for?
basics
~10 sIt returns the base HTTP address the driver process is listening on, such as http://localhost:9515. Use it to log the port, to probe the driver, or to point a RemoteWebDriver at that local driver.
In Selenium 4's WebDriver protocol, what does the value member of a command response body carry?
basics
~20 sEvery response is a JSON object with one member named value. On success it holds the command's result, which may be null, a string, an element object, an array or a script's return. On failure it holds an error object instead.
In Selenium automation, what is Chrome for Testing and why point a session at it instead of the installed Chrome?
basics
~20 sChrome for Testing is a Chrome distribution published for automation that never updates itself, with a matching driver published for every build. Pointing at it keeps browser and driver on one version, so a run stays reproducible.
In Selenium 4, how do element references, shadow root references and window handles differ as identifiers?
basics
~10 sElement and shadow root references are one-member JSON objects under different fixed keys, and both die with their document. A window handle is a bare string naming a tab, and it survives navigation.
showing 31–40 of 40