No results for

Powered byAlgolia
⚠️ This is the archived documentation for k6 v0.47. Go to the latest version.

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.

ParameterTypeDefaultDescription
url
string''URL to navigate page to. The url should include scheme, e.g. https://.
options
objectnull

Events

attention

networkidle is 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 the DOMContentLoaded event is fired.
  • 'load' - consider operation to be finished when the load event is fired.
  • 'networkidle' - Consider operation to be finished when there are no network connections for at least 500 ms.

Returns

TypeDescription
Promise<null | Response>The Response instance associated with the page. Else, it returns null.

Example

import { browser } from 'k6/experimental/browser';
export const options = {
scenarios: {
browser: {
executor: 'shared-iterations',
options: {
browser: {
type: 'chromium',
},
},
},
},
}
export default async function () {
const page = browser.newPage();
await page.goto('https://test.k6.io/browser.php');
page.close();
}