sitespeed.io
sitespeed.io copied to clipboard
Can sitespeed measure nav loads in child iframes?
Have you read the documentation?
- [X] Yes, I've read the how to make a reproducable bug guide
- [X] Yes, I've read the how to debug my script guide
URL
localhost
What are you trying to accomplish
One of our sites has content in an iframe, part of which are links to load content in another, child iframe. When I try to measure this however, sitespeed.io crashes with the below error output. If I comment the stop() and start("Open Documents") calls, to group this measurement in with the last one, sitespeed proceeds without a problem.
Does this sound like we are too far outside the use case for sitespeed.io, or is there some other things we can try?
Cheers.
What browser did you use?
Chrome
How to reproduce
await commands.wait.bySelector("#iframe1")
await commands.switch.toFrame('iframe1');
await commands.wait.bySelector("#iframe2)
await commands.switch.toFrame('iframe2');
// Just wait so we dont have to deal with not loaded problems just now
await commands.wait.byTime(30000)
await commands.measure.stop();
await commands.measure.start("Open Documents")
commands.click.byJsAndWait(`document.getElementById("linksTree").querySelectorAll("div[id*=links]")[2]`)
await commands.measure.stop()
await commands.switch.toParentFrame()
await commands.switch.toParentFrame()
Log output
ERROR: Could not generate url/summary/index, /Users/douglascl/.nvm/versions/node/v18.16.0/lib/node_modules/sitespeed.io/lib/plugins/html/templates/url/thirdparty/index.pug:24
22| h2 Third party
23|
> 24| - const thirdPartyWebVersion = pageInfo.data.coach.run ? pageInfo.data.coach.run.thirdPartyWebVersion : pageInfo.data.coach.pageSummary.thirdPartyWebVersion;
25| p Third party requests categorised by
26| a(href='https://github.com/patrickhulce/third-party-web') Third party web
27| | version #{thirdPartyWebVersion}.
Cannot read properties of undefined (reading 'run')
[2023-12-01 11:46:42] ERROR: TypeError [ERR_INVALID_ARG_TYPE]: The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received undefined
at writeFile (node:fs:2196:5)
at node:internal/util:375:7
at new Promise (<anonymous>)
at writeFile (node:internal/util:361:12)
at write (file:///Users/douglascl/.nvm/versions/node/v18.16.0/lib/node_modules/sitespeed.io/lib/core/resultsStorage/storageManager.js:26:10)
at file:///Users/douglascl/.nvm/versions/node/v18.16.0/lib/node_modules/sitespeed.io/lib/core/resultsStorage/storageManager.js:113:9
at async HTMLBuilder.render (file:///Users/douglascl/.nvm/versions/node/v18.16.0/lib/node_modules/sitespeed.io/lib/plugins/html/htmlBuilder.js:340:7)
Errors while running:
Rejected {
"uuid": "5906fa65-00e3-4121-82f7-c054a80a1537",
"type": "sitespeedio.render",
"timestamp": "2023-12-01T11:46:41+13:00",
"source": "queueHandler",
"data": "{...}"
} for plugin: html
{"code":"ERR_INVALID_ARG_TYPE"}
Error: Errors while running:
Rejected {
"uuid": "5906fa65-00e3-4121-82f7-c054a80a1537",
"type": "sitespeedio.render",
"timestamp": "2023-12-01T11:46:41+13:00",
"source": "queueHandler",
"data": "{...}"
} for plugin: html
{"code":"ERR_INVALID_ARG_TYPE"}
at start (file:///Users/douglascl/.nvm/versions/node/v18.16.0/lib/node_modules/sitespeed.io/bin/sitespeed.js:167:15)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async file:///Users/douglascl/.nvm/versions/node/v18.16.0/lib/node_modules/sitespeed.io/bin/sitespeed.js:178:1
Hi @dooglewoogle I think it should be doable. So with the start/stop measure commands that implies going to a new URL. (you can read the documentation at https://www.sitespeed.io/documentation/sitespeed.io/scripting/#measure).
What happens on the page in the iframes and what exactly do you want to measure?
Ideally I want to measure everything, but I'll settle for whatever I can, even if it's only something like response time.
When you select a link in the list, it will set the src of the child iframe to OnBeforeUnloadTrigger.htm . When that page loads it’ll call some JS from the current context, which will do different things depending on what type of thing that was selected. Which eventually set’s the src of the child iframe to the appropriate page. It reuses the iframes, but the going to a new url part doesn't happen in the iframe context we are in. Only the child one.
I see, hmm, let me think until tomorrow and get back to you.
Is it ok to just measure one "load" at a time? I would try that first, something like this:
- navigate to your base page
- measure start
- do the trick with the iframe
- measure stop
Then visual metrics will be populated with what happens in the iframe. I would run that together with --pageCompleteCheckNetworkIdle true
. That would use the browsers network log to "know" when to end the test (2 seconds of nothing happening in the network). That way the iframes requests will considered when choosing when to end.
If that doesn't work, can you make a simple HTML-page as an example that I can use to test it out? Maybe small tweaks could fix this.