abort([errorCode])
Aborts the request with the given error code.
Returns
Example
import { browser } from 'k6/browser';
export const options = {
scenarios: {
browser: {
executor: 'shared-iterations',
options: {
browser: {
type: 'chromium',
},
},
},
},
};
export default async function () {
const page = await browser.newPage();
// Abort all images requests
await page.route(/(\.png$)|(\.jpg$)/, async function (route) {
await route.abort('blockedbyclient');
});
await page.goto('https://quickpizza.grafana.com/');
await page.close();
}