How to access XHR requests using Chrome DevTools Protocol?

Viewed 481

I want to access live XHR request data in Chrome programatically. (I can't just connect to the website using a script, it must go through Chrome)

So far, I've found the easiest way to do this is to launch Chrome with remote-debugging turned on. And then use Chrome DevTools to get the data:

import PyChromeDevTools

chrome = PyChromeDevTools.ChromeInterface()
chrome.Network.enable()
chrome.Page.enable()
chrome.Page.navigate(url='http://example.com/')

The Chrome DevTools protocol guide is here: https://chromedevtools.github.io/devtools-protocol/

But I don't know how to actually access the live XHR requests.

Here's the data shown in the Chrome DevTools UI: enter image description here

The connect requests contain everything I need in the response body. I simply need access to them live (as they continue to stream in).

I just want to access this data using DevTools-protocol so I can further process it.

Any ideas how?

0 Answers
Related