innerHTML(selector[, options])
Returns the element.innerHTML
.
Returns
Type | Description |
---|---|
Promise<string> | A Promise that fullfils with the inner HTML of the element. |
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();
await page.goto('http://test.k6.io/browser.php');
const innerHTML = await page.innerHTML('#off-screen');
console.log(innerHTML);
}