jonleighton/poltergeist — pull request #77 by dmcinnes (2012-06-06 18:39:20+00:00)
Title: Capture outgoing requests

Hello!

We've been using your awesome driver for our integration tests and recently we've been trying to test tracking pixels that our application emits on certain events.
I noticed that PhantomJS has the onResourceRequested callback which gets called for any outgoing request. So all we needed was plumbing to make the requests available!

For the endpoint I added requested_resources() to Driver which returns an array of outgoing page requests since the last reset and accepts an optional filter. The results are stored in the WebPage object in PhantomJS, and the filtering is done there to limit the amount of data that could potentially get passed through the WebSocket.

Hope this is helpful. If you have any suggestions for refactoring let me know!

Thanks,
Doug