rubygoogle-chrome-devtoolsnetwork-protocols

Where can I get requestId for Network.getResponseBody?


I`m trying to write some tools with chrome Chrome DevTools Protocol https://chromedevtools.github.io/devtools-protocol/tot/Network/#method-enable.

I want get page ResponseBody and I don't know where can I find RequestId. So here is my simple Ruby code:

chrome = ChromeRemote.client

# Enable events
chrome.send_cmd("Network.enable")
chrome.send_cmd("Page.enable")

puts chrome.send_cmd "Network.getCookies"

# for this command I need RequestId ->
puts chrome.send_cmd "Network.getResponseBody" 

For now I have empty result for puts chrome.send_cmd "Network.getResponseBody".


Solution

  • You need to listen to the requestWillBeSent event, which would give you both URL and requestId