This is documentation for the next version of K6. For the latest stable release, go to the latest version.
isClosed()
Caution
This method has known issues. For details, refer to #878.
Checks if the page has been closed.
Returns
Type | Description |
---|---|
Promise<bool> | A Promise that fullfils with true if the page has been closed, else false . |
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('https://test.k6.io/browser.php');
await page.close();
console.log(await page.isClosed());
}