setContent(html[, options])
Sets the supplied HTML string to the current page.
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();
const htmlContent = `
<!doctype html>
<html>
<head><meta charset='UTF-8'><title>Test</title></head>
<body>Test</body>
</html>
`;
await page.setContent(htmlContent);
}