#16514·selenium

[ Feature]: [BIDI] Add commands to retrieve req/rsp bodies

Author: newsgrepCreated Oct 27, 2025Updated Sep 11, 2026
LabelsI-enhancementB-devtools

Description

Feature and motivation Selenium already has some Network Intercept BiDi APi which is given in the example of BiDi API. However, this API can only be used to deal with some meta-data and headers. At the moment I must rely on CDP to inspect the payload.

I would be grateful and it would help me a great deal to have a true cross-browser implementation that makes use of the WebDriver BiDi spec that can now capture the request/response with header and body.

Usage example Implement something similar to getUrl() or getHeaders(); but to get the payload of a request / response. e.g. #java

// Listener für Request & Response:
network.onBeforeRequestSent(request -> {
    System.out.println("REQUEST URL: " + request.getRequest().getUrl());
    System.out.println("REQUEST HEADERS: " + request.getRequest().getHeaders());
    System.out.println("REQUEST BODY: " + request.getRequest().getBody());
});
network.onResponseStarted(response -> {
    System.out.println("RESPONSE URL: " + response.getResponseData().getUrl());
    System.out.println("RESPONSE HEADERS: " + response.getResponseData().getHeaders());
    System.out.println("RESPONSE BODY: " + response.getResponseData().getBody());
});

It is now supported in:

More information https://github.com/SeleniumHQ/selenium/issues/16261 https://github.com/SeleniumHQ/selenium/issues/11872 https://github.com/w3c/webdriver-bidi/issues/958 https://github.com/w3c/webdriver-bidi/pull/877 https://github.com/w3c/webdriver-bidi/pull/1011 fyi: @TamsilAmani @titusfortner

Have you considered any alternatives or workarounds?

I tried to use devTools.send and devTools.addListener but was not able to get it to work in Firefox (only Chrome), using BIDI to get the url in both worked but I'm looking for a cross-browser way of inspecting the body of request/responses.