import chrome.driver;
import console
var driver = chrome.driver();
var browser = driver.startBrowser( {
loggingPrefs = { browser = 'ALL', performance = 'ALL', };
perfLoggingPrefs = {
enableNetwork = true,
enablePage= false,
enableTimeline = false
}
});
//打开网页
browser.go("https://www.baidu.com/")
win.delay(3000)
//driver.startBrowser() 指定 loggingPrefs, perfLoggingPrefs
var log = browser.se.log(type="performance"); //获取日志
for(i=1;#log.value;1){
var ref = web.json.parse(log.value[i].message)
if(ref.message.method = "Network.responseReceived"){
if(ref.message.params.requestId != null){
var requestId = ref.message.params.requestId
var json =browser.cdp("Network.getResponseBody",{"requestId":requestId})
console.dumpJson(json)
}
}
}
console.pause(true)
browser.refresh();