chromeless icon indicating copy to clipboard operation
chromeless copied to clipboard

Support generation of HAR for entire test run

Open buildscientist opened this issue 8 years ago • 5 comments

Hello, Love the project - fantastic idea.

Would it possible to modify the API such that a HAR file can be generated after the Chromeless run has completed?

There's a lot of beneficial data in the HAR file - e.g. how long an HTTP request/response cycle took? The format has a full timing based breakdown as well.

Normally the HAR file can be saved via the Chrome web inspector so I'm not sure if that's possible with headless Chrome.

Also not sure if this issue is related to #91 ?

buildscientist avatar Aug 01 '17 01:08 buildscientist

Looks like there is an existing NodeJS tool called chrome-har-capturer that provides an API for doing exactly this with headless Chrome.

buildscientist avatar Aug 01 '17 01:08 buildscientist

@adieuadieu Would you accept a PR for this feature?

A HAR file can be generated after the Chromeless run has completed.

chrome-har-capturer solves the problem but I don't think the library "at the current state" can be reused into this project.

https://github.com/cyrus-and/chrome-har-capturer/blob/master/lib/page.js#L113-#L214

Thoughts?

ppcano avatar Aug 09 '17 11:08 ppcano

Hi @ppcano — yes of course we'd welcome a PR! The challenge with chrome-har-capturer would be figuring out how it best fits (if at all) into Chromeless. Behind the scenes, Chromeless uses the same chrome-remote-interface package that chrome-har-capturer uses, but it doesn't seem like the har-capturer project's API let's you pass in an already existing CDP client..

adieuadieu avatar Aug 09 '17 14:08 adieuadieu

I create a branch to log response here which is not a full har format. And I am not satisfied with it. More work is required. Any detail about these features?

skiloop avatar Aug 22 '18 04:08 skiloop

This might be a useful reference (in terms of the events that need to be listened for and use of chrome-har to generate the HAR from those events): https://github.com/GoogleChrome/puppeteer/issues/1916#issuecomment-368452496

aral avatar Aug 24 '18 19:08 aral