sitespeedio / chrome-har

Create HAR files from Chrome Debugging Protocol data
MIT License
149 stars 50 forks source link

no har generated with Page.enable, Network.enable #57

Closed matti closed 4 years ago

matti commented 4 years ago

I have sent Page.enable and Network.enable and when I dump all events that I have received when loading example.com my events look like this:

[
  {
    "method": "Network.requestWillBeSent",
    "params": {
      "requestId": "B008822534A6FDC6F47E9345E71955AC",
      "loaderId": "B008822534A6FDC6F47E9345E71955AC",
      "documentURL": "https://example.com/",
      "request": {
        "url": "https://example.com/",
        "method": "GET",
        "headers": {
          "Upgrade-Insecure-Requests": "1",
          "User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.120 Safari/537.36",
          "Sec-Fetch-Mode": "navigate",
          "Sec-Fetch-User": "?1"
        },
        "mixedContentType": "none",
        "initialPriority": "VeryHigh",
        "referrerPolicy": "no-referrer-when-downgrade"
      },
      "timestamp": 178604.513679,
      "wallTime": 1573906240.497734,
      "initiator": {
        "type": "other"
      },
      "type": "Document",
      "frameId": "9D57A9C83BE59C00C8A87B300ADA30B8",
      "hasUserGesture": false
    }
  },
  {
    "method": "Network.responseReceivedExtraInfo",
    "params": {
      "requestId": "B008822534A6FDC6F47E9345E71955AC",
      "blockedCookies": [],
      "headers": {
        "status": "200",
        "content-encoding": "gzip",
        "accept-ranges": "bytes",
        "cache-control": "max-age=604800",
        "content-type": "text/html; charset=UTF-8",
        "date": "Sat, 16 Nov 2019 12:05:00 GMT",
        "etag": "\"3147526947\"",
        "expires": "Sat, 23 Nov 2019 12:05:00 GMT",
        "last-modified": "Thu, 17 Oct 2019 07:18:26 GMT",
        "server": "ECS (bsa/EB17)",
        "vary": "Accept-Encoding",
        "x-cache": "HIT",
        "content-length": "648"
      }
    }
  },
  {
    "method": "Network.responseReceived",
    "params": {
      "requestId": "B008822534A6FDC6F47E9345E71955AC",
      "loaderId": "B008822534A6FDC6F47E9345E71955AC",
      "timestamp": 178604.518433,
      "type": "Document",
      "response": {
        "url": "https://example.com/",
        "status": 200,
        "statusText": "",
        "headers": {
          "status": "200",
          "content-encoding": "gzip",
          "accept-ranges": "bytes",
          "cache-control": "max-age=604800",
          "content-type": "text/html; charset=UTF-8",
          "date": "Sat, 16 Nov 2019 12:05:00 GMT",
          "etag": "\"3147526947\"",
          "expires": "Sat, 23 Nov 2019 12:05:00 GMT",
          "last-modified": "Thu, 17 Oct 2019 07:18:26 GMT",
          "server": "ECS (bsa/EB17)",
          "vary": "Accept-Encoding",
          "x-cache": "HIT",
          "content-length": "648"
        },
        "mimeType": "text/html",
        "connectionReused": false,
        "connectionId": 0,
        "remoteIPAddress": "93.184.216.34",
        "remotePort": 443,
        "fromDiskCache": true,
        "fromServiceWorker": false,
        "fromPrefetchCache": false,
        "encodedDataLength": 0,
        "timing": {
          "requestTime": 178604.514472,
          "proxyStart": -1,
          "proxyEnd": -1,
          "dnsStart": -1,
          "dnsEnd": -1,
          "connectStart": -1,
          "connectEnd": -1,
          "sslStart": -1,
          "sslEnd": -1,
          "workerStart": -1,
          "workerReady": -1,
          "sendStart": 0.179,
          "sendEnd": 0.179,
          "pushStart": 0,
          "pushEnd": 0,
          "receiveHeadersEnd": 0.824
        },
        "protocol": "h2",
        "securityState": "secure",
        "securityDetails": {
          "protocol": "TLS 1.3",
          "keyExchange": "",
          "keyExchangeGroup": "P-256",
          "cipher": "AES_256_GCM",
          "certificateId": 0,
          "subjectName": "www.example.org",
          "sanList": [
            "www.example.org",
            "example.com",
            "example.edu",
            "example.net",
            "example.org",
            "www.example.com",
            "www.example.edu",
            "www.example.net"
          ],
          "issuer": "DigiCert SHA2 Secure Server CA",
          "validFrom": 1543363200,
          "validTo": 1606910400,
          "signedCertificateTimestampList": [],
          "certificateTransparencyCompliance": "unknown"
        }
      },
      "frameId": "9D57A9C83BE59C00C8A87B300ADA30B8"
    }
  },
  {
    "method": "Page.frameStartedLoading",
    "params": {
      "frameId": "9D57A9C83BE59C00C8A87B300ADA30B8"
    }
  },
  {
    "method": "Page.frameNavigated",
    "params": {
      "frame": {
        "id": "9D57A9C83BE59C00C8A87B300ADA30B8",
        "loaderId": "B008822534A6FDC6F47E9345E71955AC",
        "url": "https://example.com/",
        "securityOrigin": "https://example.com",
        "mimeType": "text/html"
      }
    }
  },
  {
    "method": "Network.dataReceived",
    "params": {
      "requestId": "B008822534A6FDC6F47E9345E71955AC",
      "timestamp": 178604.550809,
      "dataLength": 1256,
      "encodedDataLength": 0
    }
  },
  {
    "method": "Network.loadingFinished",
    "params": {
      "requestId": "B008822534A6FDC6F47E9345E71955AC",
      "timestamp": 178604.516411,
      "encodedDataLength": 0,
      "shouldReportCorbBlocking": false
    }
  },
  {
    "method": "Page.domContentEventFired",
    "params": {
      "timestamp": 178604.55525
    }
  },
  {
    "method": "Page.loadEventFired",
    "params": {
      "timestamp": 178604.557057
    }
  },
  {
    "method": "Page.frameStoppedLoading",
    "params": {
      "frameId": "9D57A9C83BE59C00C8A87B300ADA30B8"
    }
  }
]

however, no entries are found:

{
  "log": {
    "version": "1.2",
    "creator": {
      "name": "chrome-har",
      "version": "0.11.4",
      "comment": "https://github.com/sitespeedio/chrome-har"
    },
    "pages": [],
    "entries": []
  }
}
matti commented 4 years ago

nvm, I didn't start capture correctly