goto(url[, options])
Navigates to the specified URL and returns the main resource response.
Navigating to about:blank or navigation to the same URL with a different hash, will succeed and return null.
Events
Caution
networkidleis DISCOURAGED. Don’t use this method for testing especially with chatty websites where the event may never fire, rely on web assertions to assess readiness instead.
Events can be either:
'domcontentloaded'- consider operation to be finished when theDOMContentLoadedevent is fired.'load'- consider operation to be finished when theloadevent is fired.'networkidle'- Consider operation to be finished when there are no network connections for at least500ms.
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();
await page.goto('https://test.k6.io/browser.php');
await page.close();
}

