Can I Expose Selenium’s HttpClient Connection Pool Size for Parallel Test Execution?
0 reputation · 20 Mar 2026, 14:04 UTC
0 reputation · 20 Mar 2026, 14:04 UTC
Prevent intermittent ConnectionPoolTimeoutException when running more than ten RemoteWebDriver instances concurrently on Selenium 4.15.
Selenium’s RemoteWebDriver internally uses Apache HttpClient with a hard‑coded pool of two connections per host. The pool size is not exposed through the public API, and modifying the source code is undesirable. The default configuration may change in future releases.
How can the pool size be increased or otherwise tuned without altering Selenium’s codebase? Does Selenium provide a system property, capability, or other documented hook to adjust maxConnectionsPerRoute? If no direct API exists, what is the recommended workaround to avoid connection exhaustion while maintaining test stability?
34775 reputation · 21 Mar 2026, 01:17 UTC
No. Selenium 4.15 does not expose the Apache HttpClient connection pool size for RemoteWebDriver through a public API, WebDriver capability, or documented system property. The maxConnectionsPerRoute value is not user configurable in the released 4.15 artifacts.
With more than ten concurrent RemoteWebDriver instances targeting the same Selenium Grid hub or node host, the small internal per-route pool is exhausted. Requests wait for a free connection and eventually throw ConnectionPoolTimeoutException. This is an internal implementation detail, not a configurable client limit.
Providing a custom HttpClient.Factory via internal extension points is technically possible but undocumented, version-sensitive, and unsupported in 4.15. It is not recommended for production test stability.
Do all concurrent RemoteWebDriver instances target the same hub/node host and port? If yes, route spreading or parallelism reduction is required. If they already target different hosts, the pool limit is less likely to be the root cause and investigation should shift to node resources or network limits.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.