org.openqa.selenium.WebDriverException: Don't serialize binary stream - it might be large
Build info: version: '4.40.0', revision: 'b3333f1'
System info: os.name: 'Windows 11', os.arch: 'amd64', os.version: '10.0', java.version: '21.0.10'
Driver info: org.openqa.selenium.remote.RemoteWebDriver$ByteBuddy$a6W6ipHt$ByteBuddy$TTVVMAQ4
Command: [57d2b9aba360662c6a7005bfcbfd4841, downloadFile {format=application/octet-stream, name=modifiedcamfiles.zip}]
Capabilities {acceptInsecureCerts: true, browserName: chrome, browserVersion: 145.0.7632.117, chrome: {chromedriverVersion: 145.0.7632.117 (de4e5d6e13b..., userDataDir: C:\Users\DEV~1.SER\AppData\...}, fedcm:accounts: true, goog:chromeOptions: {debuggerAddress: localhost:58556}, goog:loggingPrefs: {browser: ALL, driver: ALL}, goog:processID: 776, networkConnectionEnabled: false, pageLoadStrategy: normal, platformName: Windows XP, proxy: Proxy(), se:bidiEnabled: false, se:cdp: wss://192.168.20.108:4444/s..., se:cdpVersion: 145.0.7632.117, se:downloadsEnabled: true, setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify, webauthn:extension:credBlob: true, webauthn:extension:largeBlob: true, webauthn:extension:minPinLength: true, webauthn:extension:prf: true, webauthn:virtualAuthenticators: true}
Session ID: 57d2b9aba360662c6a7005bfcbfd4841
at org.openqa.selenium.remote.ErrorCodec.decode(ErrorCodec.java:169)
at org.openqa.selenium.remote.codec.w3c.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:142)
at org.openqa.selenium.remote.codec.w3c.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:49)
at java.base/java.util.function.Function.lambda$andThen$1(Function.java:88)
at org.openqa.selenium.remote.RemoteWebDriverBuilder.lambda$createExecutor$9(RemoteWebDriverBuilder.java:483)
at org.openqa.selenium.remote.RemoteWebDriverBuilder.lambda$createExecutor$10(RemoteWebDriverBuilder.java:490)
at org.openqa.selenium.remote.RemoteWebDriverBuilder.lambda$createExecutor$11(RemoteWebDriverBuilder.java:495)
at org.openqa.selenium.remote.RemoteWebDriverBuilder.lambda$createExecutor$12(RemoteWebDriverBuilder.java:505)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:601)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:678)
at org.openqa.selenium.remote.RemoteWebDriver.downloadFile(RemoteWebDriver.java:774)
at com.systemware.swuitests.components.BaseComponent.getDownload(BaseComponent.java:2297)
Description
Environment
RemoteWebDriver.builder()org.openqa.seleniumset to FINERDescription
When attempting to download a file with
.downloadFile()from a Grid node usingRemoteWebDriver.builder()(the "new" builder-style API), the command fails with:This is due to the inclusion of
DumpHttpExchangeFilterin the RemoteWebDriver.builder()'s client filter chain, which logs all HTTP exchanges. When downstream code tries to log a streamed file download response, it callscontentAsString()on the binary stream, which triggers this error.This does not occur when:
new RemoteWebDriver(URL, Capabilities)constructorHow to Reproduce
org.openqa.seleniumto FINER or higher.Suspected Root Cause
DumpHttpExchangeFilterlogs HTTP responses by callingContents.string(HttpMessage), which invokes.contentAsString()on the response object.UnsupportedOperationException("Don't serialize binary stream - it might be large").ErrorFilter, which swallows the exception and turns it into a 500 error, which is thrown by the response codec as aWebDriverExceptionto the caller.Code/Reference Links
Reproducible Code
Debugging Logs