I have one query in Selenium 4.
Chrome exposed devtools and we are able to get network request response header as shown below, but as "addListener" method accept 2nd param as Consumer Interface so is it possible to store the headers we are printing on cmd, in a Map outside the lambda scope ? or I can understand something that all variables/objects inside lambda scope are effectively final so it is not allowed or designed like this in devTools.addListener() method of Selenium 4 ?
devTools.addListener(Network.requestWillBeSent(), request -> {
Headers header = request.getRequest().getHeaders();
if (!header.isEmpty()) {
System.out.println("Request Headers: ");
header.forEach((key, value) -> {
System.out.println(" " + key + " = " + value);
});
}
});