I'm using Capybara for web crawling, and I have the following challenge: after I interact with some DOM elements (e.g. click a button), I want to know (or make a good guess) if a new page is loading and if any AJAX requests are taking place. Because I'm crawling sites I don't necessarily control, I don't have access to the server-side state or know what to expect (i.e. it's not a matter of waiting for the page to load, it's a matter of knowing if it's happening at all).
The best case scenario would be if I could query a list of recent/ongoing/completed HTTP requests and get data from them.
Alternatively it would be nice if I could at least find out if the page is reloading/has reloaded since my last interaction.
At the very least I could check to see if the URL of the page I'm on matches the URL I used to be on, but this misses the AJAX requests, page refreshes, and doesn't wait for the page load to happen. Looking for something better than this.
I'm looking for something that works with selenium. For the non-AJAX case I would like it to work with webkit too. Any suggestions?