how to get webpage resource content via chrome remote debugging
<p>i want get webpage resource content use python via Chrome Debugging Protocol,from this page <a href="https://chromedevtools.github.io/debugger-protocol-viewer/1-1/Page/#method-getResourceContent" rel="noreferrer">method-getResourceContent</a>,i noticed this method：getResourceContent,need params frameId and url.i think this method is what i need.
so i did this thing:</p>
<p>1.get start chrome as a server: .\chrome.exe --remote-debugging-port=9222</p>
<p>2.write python test code:</p>
<pre><code># coding=utf-8
&quot;&quot;&quot;
chrome --remote-debugging api test
&quot;&quot;&quot;

import json
import requests
import websocket

import pdb

def send():
    geturl = requests.get('http://localhost:9222/json')
    websocketURL = json.loads(geturl.content)[0]['webSocketDebuggerUrl']
    request = {}
    request['id'] = 1
    request['method'] = 'Page.navigate'
    request['params'] = {&quot;url&quot;: 'http://global.bing.com'}
    ws = websocket.create_connection(websocketURL)
    ws.send(json.dumps(request))
    res = ws.recv()
    ws.close()
    print res

    frameId = json.loads(res)['result']['frameId']
    print frameId
    geturl = requests.get('http://localhost:9222/json')
    websocketURL = json.loads(geturl.content)[0]['webSocketDebuggerUrl']
    req = {}
    req['id'] = 1
    req['method'] = 'Page.getResourceContent'
    req['params'] = {&quot;frameId&quot;:frameId,&quot;url&quot;: 'http://global.bing.com'}
    header = [&quot;User-Agent: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36&quot;]
    pdb.set_trace()
    ws = websocket.create_connection(websocketURL,header=header)
    ws.send(json.dumps(req))
    ress = ws.recv()
    ws.close()
    print ress
if __name__ == '__main__':
    send()
</code></pre>
<p>3.Page.navigate work fine,i got something like this:
{&quot;id&quot;:1,&quot;result&quot;:{&quot;frameId&quot;:&quot;8504.2&quot;}}</p>
<p>4.when i try method:getResourceContent,error came out:
{&quot;error&quot;:{&quot;code&quot;:-32000,&quot;message&quot;:&quot;Agent is not enabled.&quot;},&quot;id&quot;:1}</p>
<p>i tried to add User-Agent,still not work.</p>
<p>Thanks.</p>