Menu
Open source
timing()
Returns resource timing information for the given request. Most of the timing values become available upon the response, responseEnd becomes available when request finishes.
Returns
ResourceTiming
Example
import { browser } from 'k6/browser';
export const options = {
scenarios: {
ui: {
executor: 'shared-iterations',
options: {
browser: {
type: 'chromium',
},
},
},
},
};
export default async function () {
const page = await browser.newPage();
try {
const res = await page.goto('https://test.k6.io/');
const req = res.request();
const timing = await req.timing();
console.log(`timing: ${JSON.stringify(timing)}`); // timing: {"startTime":534898988.85297775,...}
} finally {
await page.close();
}
}