I’m looking for a possibility to easily access and list all resources loaded after a web page document has started to load: scripts, images, stylesheets, etc. using a headless browser. I’m interested in the files’ url, status code and type etc..
Think of a way to programmatically access the information the Network tab (developer tools) gives you:

Does anyone know of a Ruby library to help me with this or — even better — if there’s a way to achieve this using Capybara(–webkit) ?
Update
It seems that Poltergeist has a method called network_traffic which does what I’m after. Haven’t had the time to research it yet, though. I’ll report back once I do.
As mentioned in an update, there seems to be a way to do this with Poltergeist (a Capybara driver). Here’s a quick and very “hackish” experiment:
This however is very slow and of course far from anything usable. I’m planning on digging deeper into Poltergeist to maybe do the same on a lower level.