skip to content

Selenium

3 roadmaps265 questionsupdated

The WebDriver stack that drives real browsers over an HTTP protocol, from five language bindings, with Grid for distributed runs. Interviewers ask because long-lived suites still run on it.

on this pageshow

guide

overview

~2 min

Selenium is the browser-automation project built on WebDriver: a test written in Java, Python, C#, Ruby or JavaScript sends commands over HTTP to a driver process, and the driver makes a real, installed browser carry them out. Interviewers ask about it because long-lived regression suites still run on it, and because a flaky suite shows quickly whether a candidate knows what the browser does between two lines of test code. A good answer places a failure where it happened, in the client, on the wire, in the driver or in the page, instead of reaching for a longer sleep. The hub follows a command from the test to the browser and back. [WebDriver architecture](/topics/dev-selenium-driver) is the contract underneath: sessions, the HTTP protocol and where driver binaries come from. [Element location](/topics/dev-selenium-locators) and [element interaction](/topics/dev-selenium-interactions) are the everyday API and the source of most exceptions you will be asked to explain. The [synchronization model](/topics/dev-selenium-waits) is where flakiness is won or lost. [Browser context control](/topics/dev-selenium-context) covers frames, windows, alerts, cookies and everything else that is not an element, and [screenshots and logs](/topics/dev-selenium-evidence) is what a failed run leaves behind. Scaling brings in [abstraction layers](/topics/dev-selenium-page-objects) such as PageFactory, [suite execution](/topics/dev-selenium-execution) for parallel runs and runner hooks, and [Grid deployment](/topics/dev-selenium-grid) for remote browsers. [Ecosystem and positioning](/topics/dev-selenium-ecosystem) places Selenium beside its language bindings and its rivals. Junior rounds check the API: which locator, which wait, how to enter a frame and leave it. Middle rounds ask what a call does underneath. Senior and principal rounds hand you a symptom from a real suite, such as a run green at two workers and red at six, and expect a diagnosis plus a change that stops it recurring. Learn the session and the command round trip first, then locators and waits; the other sections assume you know what one command can observe.

primer

### A test is a remote client Every Selenium call, whether a find, a click or a text read, becomes an HTTP request to a driver running outside the test process, and the driver turns it into browser actions. The test never holds the DOM itself. That is why one test body runs against several browsers, why a local run and a Grid run differ only in where requests go, and why "what does this call actually send" is a fair interview question. ### One session, one browser, one conversation A session starts when the driver launches a browser and lives until `quit()`. Its commands run one after another and share state: the current window, the current frame, cookies and timeouts all belong to the session. Sharing a session between threads, or losing track of which frame it points at, produces errors that look like broken locators. ### References are snapshots of a moving page A found element is a handle to one DOM node at one moment. Afterwards frameworks swap nodes, overlays appear and navigation discards the document. Stale references, intercepted clicks and empty finds are mostly one story told three ways: the page changed between two commands. ### Waiting is a question you write Selenium cannot know when your application is ready. It offers timeouts the driver enforces for the whole session and client-side polling over a condition you choose. Good synchronization picks the condition that matches the fact the next step depends on, and does not stack two waiting mechanisms on top of each other. ### The standard draws the portable line Commands defined by the W3C WebDriver standard are meant to behave alike across browsers. Console logs, full-page images and DevTools access sit in vendor or Selenium extensions, so a call that works on one browser can be unsupported on another, or on a remote session. Knowing which side of that line a feature sits on answers a whole family of "works on Chrome only" questions. ### A library, not a framework Selenium ships bindings, drivers, Grid and a few helpers, but no test runner and no reporter. Driver lifecycle, parallelism, failure evidence and page models are code your team owns, so interviewers probe those design choices as hard as the API.

WebDriver
The W3C-standardised protocol for remote-controlling a browser, and the Selenium interface a test calls to issue those commands.
Session
One automated browser instance, created by a new-session request and identified by a session id that each later command carries until the session is quit.
Driver binary
A browser-specific executable, such as chromedriver or geckodriver, that accepts WebDriver requests over HTTP and carries them out in its browser.
Capabilities
Key-value settings sent with a new-session request, describing which browser is wanted and how it should behave. Selenium 4 builds them through browser Options classes.
Selenium Manager
A tool bundled with Selenium 4.6 and later that locates or downloads a driver matching the installed browser when no driver path is configured.
Locator
A By strategy plus its value, such as a CSS selector or an XPath expression, telling a find command which elements to return.
WebElement
A client-side handle to one element in the page, usable only while that DOM node remains attached to the document it was found in.
Stale element reference
The error raised when a command uses an element handle whose node was removed from the page or whose document was replaced.
Implicit wait
A session-wide timeout under which the driver keeps retrying element finds before reporting that nothing matched.
Explicit wait
Client-side polling, through WebDriverWait or FluentWait, that re-runs a chosen condition until it yields a usable result or the timeout expires.
Browsing context
A window, tab or frame that holds a document. A session targets one at a time, and switching changes where every later command lands.
Shadow root
The root of an encapsulated DOM subtree attached to a host element. Ordinary finds started from the document do not cross into it.
PageFactory
Selenium's Java helper that fills annotated page-object fields with proxies, which perform the lookup when a method is called on the field.
Selenium Grid
Selenium's server for running sessions on other machines: it accepts new-session requests, matches them to free node capacity and forwards each command.
WebDriver BiDi
A newer bidirectional WebDriver protocol over WebSocket, letting the browser push events such as console messages or network activity to the client.

Follow one command through the stack. A binding turns a method call, say a click, into an HTTP request addressed to a session. Locally that request goes to a driver process the client started on a loopback port; remotely it goes to Grid, whose router forwards it to the node holding the session. The driver performs the command in the browser, inside whichever window and frame are selected, and replies with a value or a W3C error that the binding raises as a typed exception. In classic WebDriver nothing is pushed to the test: the client learns about the page only by asking, so waits are polling and the page may move on between two requests. The sections hang off this loop: - **Locators and interactions** are the commands; their exceptions are the driver's error replies. - **Waits** decide when the next command is sent. - **Context control** changes where a command lands without changing the command. - **Evidence** asks the same session for images and logs, partly through standard commands and partly through extensions or a BiDi socket. - **Page objects and execution** are client-side code deciding who owns a session and how locators are reused. - **Grid** moves the driver to another machine and leaves the test body alone. The snippet shows three of those layers meeting: capabilities fixed once at session start, a wait that decides when to act, and a final command the browser still judges for itself. ```java ChromeOptions options = new ChromeOptions(); options.setPageLoadStrategy(PageLoadStrategy.EAGER); // travels in the new-session request WebDriver driver = gridUrl == null ? new ChromeDriver(options) // local driver process : new RemoteWebDriver(gridUrl, options); // same request, routed by Grid try { driver.get("https://shop.example.test/checkout"); WebElement pay = new WebDriverWait(driver, Duration.ofSeconds(10)) .until(ExpectedConditions.elementToBeClickable(By.cssSelector("[data-test=pay]"))); pay.click(); // obstruction is judged here, not in the wait } finally { driver.quit(); // frees the browser, or the Grid slot } ``` The wait vouches only for visibility and the enabled state when it returned, and `quit()` in `finally` keeps a failed test from leaking a browser or a Grid slot.

  1. WebDriver Architecture →

    Start with the session and the HTTP round trip; every later section assumes you know what one command can see.

  2. Element Location →

    How a test names an element: the By strategies, CSS and XPath, and what a find hands back.

  3. Element Interaction →

    What you do with an element once found, and how to read the exception when a command cannot land.

  4. Synchronization Model →

    Synchronization makes sense once commands and their failures are clear; it is where most flakiness is decided.

  5. Browser Context Control →

    Frames, windows, alerts and cookies explain why a correct locator sometimes finds nothing at all.

  6. Suite Execution →

    Running sessions in parallel safely, and the runner hooks that open and close them, before scaling out to Grid.

  • Answering flakiness with Thread.sleep or a longer implicit wait instead of waiting for the specific fact the next step depends on.

  • Combining an implicit wait with explicit waits in one session, then being surprised when timeouts fire later than either setting suggests.

  • Treating a passed clickability wait as proof the click will land; obstruction is checked only when the click runs, see this question.

  • Asserting that an element is gone with a locator never shown to match it; a typo in the selector passes exactly like a vanished element.

  • Letting several threads drive one WebDriver, or parking drivers in a ThreadLocal that teardown never clears on a pooled thread.

  • Blaming the locator when the session is still inside an iframe it switched into, or still pointed at a window that close() removed.

  • Calling an extension feature, such as console log retrieval or a full-page screenshot, as if it were standard WebDriver that every browser and remote session supports.

  • Adding @CacheLookup to a field the page re-renders, which trades a fresh lookup for a stale reference.

This guide assumes Selenium 4 with a current 4.x client. Interviewers still ask what changed since Selenium 3, because many suites were first written against it and carry its habits: - **4.0** made the W3C WebDriver protocol the dialect the client speaks, retiring the older JSON Wire Protocol. Browser Options classes replaced DesiredCapabilities for local sessions, Grid was rebuilt as separate components that can also run together in standalone mode, and relative locators arrived. - **4.6** bundled Selenium Manager, which made driver-path properties and third-party driver-manager libraries optional. - **Through the 4.x line**, WebDriver BiDi support has been growing as the cross-browser route to browser events. The older route, the Chrome DevTools Protocol, ties a suite to Chromium-based browsers and to version-specific support modules. When an answer depends on version, such as how drivers are provisioned, how a Grid is laid out, or whether a logging call works on a given browser, say which release you mean. Interviewers maintaining an older suite will ask about Selenium 3 behaviour, and naming the era is part of a good answer.

Selenium is a browser layer, so it always arrives with partners. Tests run under the language's usual runner, such as JUnit or TestNG in Java and pytest in Python, which supplies lifecycle hooks, parallelism and reports. Browsers come from local installs, Selenium's Docker images, a self-hosted Grid or a cloud browser service that speaks the same protocol. Appium extends the WebDriver protocol to mobile apps, so much of the session and locator vocabulary carries over. The comparison interviewers ask for is with Playwright and Cypress. Playwright ships its own runner and built-in auto-waiting and drives browsers through its own protocol rather than the W3C standard. Cypress runs its tests inside the browser alongside the application, in JavaScript only. Selenium's case rests on the standard: the browser vendors' own drivers, five official languages, and long-lived suites that already depend on it. The cost is a harness you assemble yourself. A defensible choice names the team's languages, the browsers it must cover and the suite it already has. [Tooling comparisons](/topics/dev-selenium-ecosystem-position) goes deeper.

explore

report an issue with this guide →

questions

265 · 10 sections

Where does Selenium Manager store the drivers it downloads, and does every Selenium 4 run download again?

level: juniorimportance: must knowfreq 56%
basics
~20 s

In a per-user cache folder, by default ~/.cache/selenium, and no. Selenium 4's Selenium Manager reuses a matching cached driver on later runs and downloads only when the cache has no suitable copy. SE_CACHE_PATH moves the folder.

open as a page

In Selenium 4, what happens when you construct a ChromeDriver without configuring any chromedriver path?

level: juniorimportance: must knowfreq 74%
basics
~20 s

Selenium Manager runs automatically. The binary bundled in the Selenium 4 client detects the installed Chrome, works out the matching chromedriver, downloads it if the local cache lacks it, and returns the path, so the session starts with no PATH entry and no setup code.

open as a page

In Selenium 4, what does setting the `webSocketUrl` capability to true on a new session do?

level: juniorimportance: must knowfreq 64%
basics
~20 s

It asks the remote end to open a WebDriver BiDi socket for that session. If the remote end supports BiDi, the capabilities it returns contain webSocketUrl again, this time as the ws:// address the client connects to.

open as a page

In Selenium 4, what actually happens when a Java test calls new ChromeDriver()?

level: juniorimportance: must knowfreq 85%
basics
~20 s

Constructing ChromeDriver starts a local driver process, waits for it to listen on a free loopback port, then sends it a new-session request. The driver launches the browser and replies with a session id that every later command carries.

open as a page

In Selenium 4, how does a client choose between a configured driver executable and Selenium Manager?

level: middleimportance: must knowfreq 55%
basics
~20 s

An explicitly configured executable wins. If a driver path is set on the service builder or through the webdriver.chrome.driver system property, the Selenium 4 client launches that file; only when nothing is configured does it hand resolution to the bundled Selenium Manager.

open as a page

In Selenium, why does By.cssSelector fail on an element inside a web component's shadow tree?

level: juniorimportance: must knowfreq 68%
basics
~20 s

The find command searches one node tree from a single start node, and a shadow tree is a separate tree, so a descendant selector never reaches inside. Find the host, take its shadow root, search again from there.

open as a page

In Selenium, what does each driver.findElement call cost when a test loops over many rows?

level: juniorimportance: must knowfreq 66%
basics
~20 s

Each findElement call is one HTTP command to the browser driver, sent as POST /session/{id}/element. A loop over 300 rows sends 300 separate commands, and those round trips add up no matter how simple the selector is.

open as a page

In Selenium, why can a CSS locator never match an element by its visible text?

level: middleimportance: must knowfreq 72%
basics
~20 s

Because a CSS selector matches on tags, ids, classes, attributes, structural position and state, never on the characters inside an element. Selenium sends the string straight to the browser's querySelectorAll, so a locator gets exactly that power and no more.

open as a page

In Selenium 4, what geometric rule does RelativeLocator's above() apply, and why do overlapping elements match no direction?

level: middleimportance: must knowfreq 62%
basics
~20 s

Selenium compares bounding rectangles edge to edge: a candidate is above an anchor only when the candidate's bottom edge sits at or higher than the anchor's top edge. Any overlap fails all four directional tests.

open as a page

In Selenium, which two checks does ExpectedConditions.elementToBeClickable actually perform before returning?

level: juniorimportance: must knowfreq 74%
basics
~10 s

Just two: isDisplayed and isEnabled. Selenium's elementToBeClickable locates the element, confirms the browser renders it and that it is not disabled, then returns it. Nothing in the condition asks whether something covers it.

open as a page

In Selenium's Java bindings, what does the FluentWait class let a test configure about a wait?

level: juniorimportance: must knowfreq 62%
basics
~10 s

FluentWait is Selenium's configurable wait. withTimeout sets how long it keeps trying, pollingEvery sets the gap between tries, ignoring and ignoreAll list exception types to swallow and retry, and withMessage sets the timeout text.

open as a page

In Selenium, what happens if you set an implicit wait and also use WebDriverWait in the same session?

level: juniorimportance: must knowfreq 76%
basics
~10 s

Wait times become unpredictable. Selenium's documentation warns against mixing the two, and gives the example of a 10-second implicit wait with a 15-second explicit wait producing a timeout after 20 seconds.

open as a page

In Selenium, how does ExpectedConditions.stalenessOf decide that the element it was given is gone?

level: middleimportance: must knowfreq 53%
basics
~20 s

By calling a method on the reference each poll and watching for it to fail. Selenium 4 calls isEnabled and discards the result; when that raises a stale element reference or no such element error, the condition returns true.

open as a page

In Selenium's ExpectedConditions, which helpers hand back a usable WebElement and which only hand back a Boolean?

level: middleimportance: must knowfreq 61%
basics
~20 s

Helpers that ask for a node return it: presenceOfElementLocated, visibilityOfElementLocated, visibilityOf and elementToBeClickable give a WebElement, the all-elements helpers give a list, alertIsPresent gives an Alert. Helpers that assert a page fact, such as invisibilityOfElementLocated, stalenessOf and titleIs, give only a Boolean.

open as a page

In Selenium, which class performs a hover or a right-click, and what call actually runs it?

level: juniorimportance: must knowfreq 76%
basics
~10 s

Selenium's Actions class builds them: moveToElement for a hover, contextClick for a right-click, plus doubleClick, clickAndHold, release and dragAndDrop. Nothing reaches the browser until you call perform() on the chain.

open as a page

In Selenium, what does ElementClickInterceptedException mean, and what does its message name?

level: juniorimportance: must knowfreq 74%
basics
~20 s

The click target is covered: another element sits over its centre point and would receive the click. The driver's message names that intercepting element, usually its opening tag with id and class, so read it.

open as a page

In Selenium, how does the string given to JavascriptExecutor.executeScript run, and how do you get a value back?

level: juniorimportance: must knowfreq 72%
basics
~20 s

Selenium runs the string as the body of an anonymous function in the current frame, so you need an explicit return to get a value; without one you get null. Values passed after the script appear as arguments[0], arguments[1].

open as a page

In Selenium, which three methods does the Select class offer to choose an option, and what does each match?

level: juniorimportance: must knowfreq 82%
basics
~10 s

Selenium's Select class offers selectByVisibleText, which matches an option's rendered text; selectByValue, which matches its value attribute exactly; and selectByIndex, which matches its zero-based position. Each throws NoSuchElementException when nothing matches.

open as a page

In Selenium, which Java types may be passed to executeScript, and what types can its result be?

level: middleimportance: must knowfreq 62%
basics
~20 s

You may pass numbers, booleans, strings, WebElements, and lists or String-keyed maps of those; anything else throws IllegalArgumentException. Results come back as Boolean, Long, Double, String, List, Map, WebElement or null, and always need a cast.

open as a page

In Selenium, how do you read a JavaScript confirm dialog's text and then accept or cancel it?

level: juniorimportance: must knowfreq 78%
basics
~10 s

Take the dialog with driver.switchTo().alert(), which returns an Alert. Call getText() for its message, then accept() to press OK or dismiss() to press Cancel. Use sendKeys only on a prompt, before accepting it.

open as a page

In Selenium, which Chrome preferences make a download land in a directory your test picked, with no save prompt?

level: juniorimportance: must knowfreq 74%
basics
~20 s

Set the Chrome preference download.default_directory to an absolute path and download.prompt_for_download to false, passed as the prefs experimental option on ChromeOptions. The browser then writes the file into that folder on whichever machine runs the browser.

open as a page

In Selenium, what is the difference between driver.get(url) and driver.navigate().to(url)?

level: juniorimportance: must knowfreq 78%
basics
~10 s

Nothing functional separates them. Both send the same WebDriver Navigate To command and load the URL in the current tab. navigate() exists because the object it returns also carries back, forward and refresh.

open as a page

A Selenium test fails with UnhandledAlertException and the confirm dialog is gone by the time you look. Why?

level: seniorimportance: must knowfreq 52%
basics
~10 s

Selenium 4 sessions default to the dismiss and notify prompt handler, so the remote end dismissed the dialog and then failed that command with UnhandledAlertException. Nothing lost the dialog; the default answered it.

open as a page

A Selenium suite calls addCookie before navigating and every test throws InvalidCookieDomainException — why, and what is the fix?

level: seniorimportance: must knowfreq 70%
basics
~20 s

WebDriver can only set a cookie for the document the browser currently holds. A fresh session sits on a blank page with no host, so there is nothing for the cookie to belong to and addCookie rejects it. Navigate to the target origin first.

open as a page

In Selenium 4, what does Take Element Screenshot return when the element is taller than the viewport?

level: middleimportance: must knowfreq 61%
basics
~20 s

Only the visible part. Take Element Screenshot scrolls the element into view and then paints from the viewport framebuffer, so an element taller than the window comes back clipped at the viewport edge, never stitched.

open as a page

A Selenium suite reads browser console entries on Chrome but the same code throws on Firefox. Why, and how do you handle it?

level: seniorimportance: must knowfreq 62%
basics
~10 s

Log retrieval was never standardised in W3C WebDriver, so Selenium routes it to its own extension endpoint. ChromeDriver implements that endpoint and geckodriver does not, so the call throws UnsupportedCommandException on Firefox.

open as a page

In Selenium, why does a failure hook's element screenshot throw StaleElementReferenceException, and how do you make the capture safe?

level: seniorimportance: must knowfreq 43%
basics
~20 s

Element references die with the node they point at. Take Element Screenshot resolves the reference before it paints, so a hook capturing after the page re-rendered gets a stale element reference instead of an image.

open as a page

In Selenium 4, how do you capture a whole-page image in Firefox, and what changes when the session is remote?

level: seniorimportance: must knowfreq 52%
basics
~20 s

Firefox exposes getFullPageScreenshotAs through the HasFullPageScreenshot interface, backed by a Mozilla extension endpoint rather than a standard command. Over a remote session the object is a RemoteWebDriver, so you must wrap it with Augmenter before the cast succeeds.

open as a page

In Selenium's Java client, how do you read a page's browser console output, and what comes back?

level: juniorimportance: should knowfreq 58%
basics
~10 s

Call driver.manage().logs().get(LogType.BROWSER). It returns a LogEntries collection of LogEntry objects, each carrying a level, a timestamp in epoch milliseconds, and the message text. Each call drains the buffer it read.

open as a page

In Selenium, what does a component-scoped page object hold so its lookups stay inside one widget?

level: juniorimportance: must knowfreq 66%
basics
~10 s

It holds the widget's root element. WebElement implements SearchContext, so the class searches through that root on every lookup and can never match a node that lives outside the widget it models.

open as a page

In Selenium's @FindBy annotation, what is the difference between the shorthand attributes and the how/using pair?

level: juniorimportance: must knowfreq 74%
basics
~10 s

There is no behavioural difference for the everyday strategies: @FindBy(id = "x") and @FindBy(how = How.ID, using = "x") build the same By. The pair exists for How.ID_OR_NAME, which has no shorthand attribute.

open as a page

In Selenium's PageFactory, what changes when you pass a WebElement to initElements instead of the driver?

level: middleimportance: must knowfreq 58%
basics
~20 s

Every proxied field is then located through that element instead of the whole document. PageFactory wraps whatever context you pass in a DefaultElementLocatorFactory, so each lookup starts at that element rather than at the page root.

open as a page

In Selenium's PageFactory, how do @FindBys and @FindAll differ when they annotate the same page-object field?

level: middleimportance: must knowfreq 62%
basics
~10 s

@FindBys builds a ByChained: each locator is searched inside the elements the previous one matched. @FindAll builds a ByAll: every locator runs against the same context and the matches are merged into one union.

open as a page

In Selenium's PageFactory, how do you bind a List<WebElement> field, and what happens to a field left unannotated?

level: juniorimportance: should knowfreq 47%
basics
~20 s

A list field takes the same @FindBy and is resolved with findElements, but the annotation is required or the field stays null. An unannotated WebElement field is bound using its own name as an id, then a name.

open as a page

In Selenium's Docker images, why is --shm-size=2g recommended for browser containers?

level: juniorimportance: must knowfreq 66%
basics
~20 s

Browsers put rendered content in the shared-memory filesystem /dev/shm, and Selenium's image docs say Chrome crashes on the small 64 MB allocation a container gets by default. Passing --shm-size=2g, or shm_size: 2gb in compose, gives it room.

open as a page

In Selenium Grid, what is the difference between the hub role and the node role?

level: juniorimportance: must knowfreq 82%
basics
~20 s

The hub is the grid's single entry point: it takes session requests from test clients and hosts the event bus that nodes register on. A node owns a machine's browsers and runs the sessions the hub places on it.

open as a page

In Selenium Grid 4, what does the /status endpoint return and what does its ready flag mean?

level: juniorimportance: must knowfreq 66%
basics
~20 s

Selenium Grid's /status returns JSON holding a boolean ready flag, a message, and a nodes array describing every registered node and its slots. Ready is true only when at least one node is up and has a free slot.

open as a page

In Selenium 4, how do you point a test at a Grid endpoint instead of starting a local browser?

level: juniorimportance: must knowfreq 76%
basics
~20 s

Build a RemoteWebDriver with two arguments: the Grid's URL and an options object such as ChromeOptions. Those options become the session request the Grid routes, and every line of test code after that is unchanged.

open as a page

In Selenium Grid, what does a Node's --max-sessions flag default to, and what silently caps it?

level: middleimportance: must knowfreq 60%
basics
~20 s

A Selenium 4 Node's --max-sessions defaults to the number of processors its JVM reports. Selenium clamps any higher value back to that number unless --override-max-sessions true is passed, and a Node never runs more sessions than it declared slots.

open as a page

In Selenium, can two test threads safely share a single WebDriver instance?

level: juniorimportance: must knowfreq 76%
basics
~10 s

No. A Selenium WebDriver object carries no thread-safety guarantee, and one session drives one browser, so two threads issuing commands through it interleave into a single confused conversation. Give every thread its own driver.

open as a page

In a Selenium suite, how does a ThreadLocal<WebDriver> holder work, and why must teardown call remove()?

level: middleimportance: must knowfreq 74%
basics
~20 s

A ThreadLocal holder stores one WebDriver per thread, so each parallel test gets its own browser session. Teardown must quit the driver and call remove, or the entry survives on a reused pool thread and the next test inherits it.

open as a page

A Selenium suite is green at two workers and flaky at six on one host - how do you tell a per-worker collision from memory pressure?

level: seniorimportance: must knowfreq 65%
basics
~20 s

A collision fails early and asymmetrically: the first worker survives and the rest die at session start or read each other's files. Memory pressure fails late and everywhere, worsens smoothly with worker count, and kills browsers mid-test.

open as a page

In a parallel Selenium run, cases throw NoSuchWindowException and failure screenshots show another test's page. What is the cause?

level: seniorimportance: must knowfreq 58%
basics
~10 s

Two or more threads are driving one Selenium session. Both symptoms are the same fact: every thread's command lands in one browser whose window and page another thread has already changed underneath it.

open as a page

How do you choose how many parallel Selenium browser workers a single machine should run?

level: principalimportance: must knowfreq 50%
basics
~20 s

Measure it on the real hardware; there is no formula. Each worker runs a whole browser process tree, so memory and CPU cap the count long before threads do. Ramp the workers up until per-case time degrades, then back off.

open as a page

In Selenium 4, what replaces the Selenium 3 DesiredCapabilities object when you start a local Chrome session?

level: juniorimportance: must knowfreq 78%
basics
~10 s

A browser Options object. In Selenium 4 you build ChromeOptions, FirefoxOptions or EdgeOptions and pass it to the driver constructor; DesiredCapabilities is no longer how a local session is configured.

open as a page

After upgrading to Selenium 4.6 or later, which driver-binary setup code can you delete, and why?

level: juniorimportance: must knowfreq 66%
basics
~20 s

The driver-path setup. Selenium 4.6 and later bundle Selenium Manager, which locates or downloads a matching browser driver when no driver path is set, so the webdriver.chrome.driver property and any third-party driver-manager bootstrap can be deleted.

open as a page

In Selenium 4, why can one test body drive Chrome, Firefox, Edge and Safari without a rewrite?

level: juniorimportance: must knowfreq 76%
basics
~20 s

Because every one of those browsers is automated through the same W3C WebDriver command set. Only the driver and options objects built at start-up differ; finding elements, clicking, reading text and waiting are identical calls.

open as a page

Which languages does the Selenium project itself ship client bindings for at Selenium 4?

level: juniorimportance: must knowfreq 68%
basics
~10 s

Selenium 4 ships official clients for Java, Python, C#/.NET, Ruby and JavaScript. Other languages such as PHP, R and Rust are covered by community bindings maintained outside the project, which speak the same protocol.

open as a page

In Selenium 4's JavaScript client, why must nearly every driver call be awaited?

level: middleimportance: must knowfreq 58%
basics
~20 s

Because every command returns a promise rather than a value, and Selenium 4 removed the old control flow that ordered commands for you. Without await you hold a promise, which is always truthy, so conditions silently pass.

open as a page