Skip to content

[🐛 Bug]: network.onResponseCompleted does not return full response body content #16261

@dineshkumar-kanniyammal

Description

Description

When intercepting and continuing responses with Selenium BiDi network.onResponseCompleted, the response body content is not fully available. Instead, it only returns the length (e.g., Optional[1088]) instead of the actual response JSON/text.

  1. I am using Selenium BiDi with Firefox and trying to capture the response body content.
  2. The onResponseCompleted event gives me responseDetails.getResponseData().getContent(), but instead of the actual response payload (JSON/text), it shows only the size of the content as Optional[1088].
  3. This makes it impossible to parse or log the actual API response.
Image Image Image

Reproducible Code

FirefoxOptions options = new FirefoxOptions();
options.setBrowserVersion("140.0");
options.setCapability("webSocketUrl", true);
WebDriver driver = new FirefoxDriver(options);

Network network = new Network(driver);
network.addIntercept(new AddInterceptParameters(InterceptPhase.RESPONSE_STARTED));

network.onResponseCompleted(responseDetails -> {
 System.out.println("Response Url"+ responseDetails.getResponseData().getUrl());
 System.out.println("Response Content "+responseDetails.getResponseData().getContent().toString());

network.continueResponse(new ContinueResponseParameters(responseDetails.getRequest().getRequestId()));});

 BrowsingContext browsingContext = new BrowsingContext(driver, driver.getWindowHandle());
 browsingContext.navigate("https://reqres.in/api/users?page=2",ReadinessState.COMPLETE);

Debugging Logs

Response Url https://reqres.in/api/users?page=2
Response Content Optional[1088]
Aug 26, 2025 4:44:14 PM org.openqa.selenium.bidi.Connection send
INFO: -> {
  "method": "network.continueResponse",
  "id": 7,
  "params": {
    "request": "20"
  }
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions