firefox java javascript selenium selenium-webdriver

How to get transferred size of a complete page load?

With Selenium or JavaScript how could you get the (over the network) transferred size (bytes) of the loaded page including all the content, images, css, js, etc?

The preferred size is that of what goes over the network, that is compressed, only for the requests that are made, etc.

This is what you usually can see in dev tools, to the right in the network status bar:
Firefox > Dev Tools > Network > statusbar


If that’s not possible, could one just get a total size of all the loaded resources (without compression, etc)? That would be an acceptable alternative.

The browser is Firefox, but if it could be done with some other Selenium compatible browser that would be acceptable also.


I guess this could be done using a proxy, but is there any JS or Selenium way to get such information?

If proxy is the only way, which one would one use (or implement) to keep things simple for such a task? Just implementing something in Java before setting up the driver?

(The solution should work at least on Linux, but preferably on Windows also. I’m using Selenium WebDriver via Java.)