I am building a personal scraper using the chromedp package. I would like to get my FCP(First Contentful Paint) and other stats. Unfortunately I am unable to find a way to do this, then I got the idea of extracting it from the developer console.
Unfortunately I am unable to find any tutorials on the internet after two days of fiddling around with it.
Can anyone tell me please how I can measure the FCP and other metrics with chromedp?
I tried this but it returns an error: encountered an undefined value. But when I type it into my browser's console it actually does work.
chromedp.EvaluateAsDevTools("const paintTimings = performance.getEntriesByType('paint');", nil),
chromedp.EvaluateAsDevTools("const fmp = paintTimings.find(({ name }) => name === \"first-contentful-paint\");", nil),
chromedp.EvaluateAsDevTools("console.log('First contentful paint at foo');", &jscript))
I figured out that the problem I have is, that when a console.log is executed devtools also returns a undefined which collides with what Go expects. Does anyone know how to fix this?