-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
Open
Labels
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.
- I am using Selenium BiDi with Firefox and trying to capture the response body content.
- 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].
- This makes it impossible to parse or log the actual API response.



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"
}
}