Selenium 4 FAQs: Setup, Grid, BiDi, and Troubleshooting
Answers to common Selenium 4 questions: driver setup, local runs, Grid, WebDriver BiDi, CDP, troubleshooting, and when a screenshot API may be simpler.
Selenium 4 is the current major line of Selenium WebDriver, a browser automation API that can control a browser on the same machine or connect to a remote browser. For a basic local script, install a language binding and a supported browser; modern Selenium Manager handles much of the driver setup in many standard environments. You do not need Selenium Server for a local run. Use Selenium Grid and RemoteWebDriver when tests need remote or shared browser capacity. Selenium WebDriver documentation · Selenium Manager documentation.
What is Selenium 4?
Selenium is a browser automation project whose WebDriver API lets a program control a browser through a language binding and a browser-specific implementation. It supports local sessions and remote sessions. The WebDriver protocol is a W3C Recommendation; related standards work continues, so emerging protocol features should not be assumed to have the same maturity as the core WebDriver standard. See the W3C WebDriver Recommendation and the W3C WebDriver publication history.
How do I install Selenium 4 and run a local test?
Install the binding for your language, make sure a supported browser is installed, and create a WebDriver instance. The Python example below is a complete small script. It opens a page, prints the title, and closes the browser even if an error occurs.
python -m pip install selenium
from selenium import webdriver
browser = webdriver.Chrome()
try:
browser.get("https://example.com")
print(browser.title)
finally:
browser.quit()
Current Selenium Python documentation says Selenium Manager can manage browser and driver installation when a WebDriver instance is created. In many standard setups, you therefore do not need to download ChromeDriver and place it on PATH yourself. This is not a guarantee for every environment: restricted networks, custom browser locations, permissions, and browser-specific problems can still require configuration or diagnosis. Check the current Selenium Manager guide and the browser-specific WebDriver docs.
Do I need to download ChromeDriver manually?
Often no, with a current Selenium binding and a standard local browser installation. Selenium Manager automates much of driver management. If setup fails, inspect the full error, verify the browser is installed and supported, check network access to the required downloads, and consult the current binding and browser documentation. Explicit driver installation may still be appropriate for custom or isolated environments.
Do I need Selenium Server to run tests locally?
No. A local WebDriver script talks to a local browser; the Selenium Python API documentation explicitly says the Java server is not needed for local scripts. Selenium Server is used when you run a Grid and connect to remote browser sessions. See the Python API documentation and the Grid documentation.
How do I run a test against Selenium Grid 4?
Grid provides remote WebDriver sessions. The official quick start calls for Java 11 or newer, one or more browsers, a Selenium Server JAR, and browser drivers or Selenium Manager configuration. Follow the live installation guide for the current JAR version and deployment options.
- Install Java 11 or newer and the browser or browsers the Grid node will run.
- Download the current Selenium Server JAR from the Selenium downloads page.
- Start a standalone Grid, substituting the actual downloaded version in the filename:
java -jar selenium-server-<version>.jar standalone
Then point a RemoteWebDriver client at http://localhost:4444. Example in Python:
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
options = Options()
browser = webdriver.Remote(
command_executor="http://localhost:4444",
options=options,
)
try:
browser.get("https://example.com")
print(browser.title)
finally:
browser.quit()
This is a local standalone Grid example, not a distributed production deployment recipe. For containers, multiple nodes, authentication, network boundaries, or production operations, use the current Selenium Grid documentation. A remote session depends on the Grid endpoint being reachable and on the requested browser being available there.
What is WebDriver BiDi?
WebDriver BiDi adds a bidirectional WebSocket communication channel between the automation client and browser. This allows event streaming as well as commands, including documented areas such as logging, network, and script APIs. Selenium describes BiDi as the cross-browser direction for capabilities historically associated with browser-specific developer protocols. Actual availability depends on the language binding, browser, and feature; check the current Selenium BiDi documentation before relying on a specific event or command. The W3C lists BiDi as a Working Draft, which is provisional standards work: W3C WebDriver BiDi.
What is the difference between WebDriver BiDi and CDP?
| Aspect | WebDriver BiDi | CDP |
|---|---|---|
| Meaning | W3C bidirectional extension to WebDriver | Chrome DevTools Protocol |
| Communication | WebSocket channel supports commands and streamed events | Browser developer-tools protocol used by Chromium-based tooling |
| Portability direction | Designed as a cross-browser protocol path | Browser-specific protocol; Selenium describes its CDP support as temporary while BiDi support is implemented |
| Practical choice | Prefer when the needed feature is available for your browser and binding | May be relevant when a required capability is available through CDP but not yet through BiDi in your stack |
Do not assume feature parity, identical APIs, or universal browser support. Check Selenium’s live BiDi and CDP guidance for your exact binding and browser, and the W3C protocol draft for the standards status.
How do I choose local WebDriver or Grid?
- Choose local WebDriver for a script or test running against a browser on the same machine. It has fewer moving parts and needs no Selenium Server.
- Choose Grid with RemoteWebDriver when browser sessions must run remotely, be shared across test workers, or use a central pool. You then need to operate and reach the Grid endpoint and provide the browsers it offers.
The Selenium documentation supports both execution models; it does not establish general cost or performance benchmarks for them. Measure your own suite and infrastructure before choosing a capacity plan.
Common Selenium 4 errors and fixes
| Symptom | Likely cause | What to check |
|---|---|---|
| Driver or browser cannot be found | Browser is missing, driver management could not complete, or a custom install is outside the expected location | Confirm the browser is installed and supported; check network and permissions; review Selenium Manager output and current browser setup docs. |
| Session creation fails | Browser and driver mismatch, unsupported capabilities, or the remote endpoint cannot create the requested session | Read the complete exception; check browser version, options, and Grid node availability. |
| Connection refused at port 4444 | Grid is not running, listens elsewhere, or is unreachable from the client | Start the standalone server, verify its configured address and port, and ensure the client uses the reachable URL. |
| Remote session times out | Grid node is busy or unavailable, startup is slow, or network access is interrupted | Check Grid status and node logs; confirm the requested browser is present and the network path remains open. |
| BiDi command or event is unsupported | The browser, binding, or specific feature does not implement it yet | Verify the feature-specific documentation for the exact browser and language binding; do not infer support from BiDi’s general protocol description. |
Performance, reliability, and cost considerations
Local sessions avoid operating a remote Grid, while Grid can centralize remote browser access and enable a shared pool. The tradeoff is additional server, browser-node, and network dependencies. Selenium’s cited setup and protocol documentation does not provide universal performance numbers or a pricing model. Selenium itself is software; the cost of a deployment depends on the machines, browser capacity, and operations you choose. For reliability, always close sessions with quit(), keep browser and binding versions supported, and make remote endpoint health and node availability observable in your own environment.
Or skip the browser setup
If your task is to capture a page image or PDF rather than interact with it as a test, ScreenshotNeo is a website screenshot API and MCP server from Yorker Media. One GET request returns a PNG, JPEG, WebP, or PDF. It removes cookie and consent banners, newsletter popups, and chat widgets before capture; bot checks, blank pages, and failed loads are never billed; and an MCP server lets AI agents take screenshots. The free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000. See the ScreenshotNeo API documentation.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com -o shot.webp
Python:
import requests
r = requests.get(
"https://api.screenshotneo.com/v1/shot",
params={"access_key": "YOUR_API_KEY", "url": "https://example.com"},
timeout=90,
)
open("shot.webp", "wb").write(r.content)
Node.js:
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://example.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
Create a free ScreenshotNeo account for 1,000 screenshots a month, with no card required.
Frequently asked questions
What is the latest Selenium 4 release?
Release numbers change and can differ across language bindings. Check the Selenium release index and the package or API page for your binding rather than relying on one version number in a static guide.
Can Selenium take screenshots?
WebDriver browser sessions can be used as part of a browser automation workflow, including capturing browser output. If the requirement is a screenshot or PDF from a URL without a test interaction flow, a screenshot API such as ScreenshotNeo may reduce the browser setup involved.
Is WebDriver BiDi finalized?
The W3C source cited here lists BiDi as a Working Draft. Check the current publication status and Selenium’s binding-specific feature documentation for the state relevant to your project.


