Navigate to URL in Playwright

Profile picture for user arilio666

In this article, we will see how we can navigate to URL in playwright Using 'goto,' we can navigate between URLs in playwright.

goto returns the primary resource response, and in case of multiple redirects, it resolves to the first non-redirect response.

await page.goto(url);
await page.goto(url, options);

Troublesome If:

  • There's an SSL error related to the signed certificates of the site.
  • Invalid URL.
  • Exceeding timeout.
  • Unreachable server.
  • The resource failed to load.

Arguments Used In goto:


  • Type string is passed.
  • Pass in the URL to navigate to the page.
  • It should include a scheme like https://.
  • When baseURl via context is provided, it is passed via a new URL() constructor.


These are entirely optional.

Referer:- Referer header value can be provided as an option.
Timeout:- Timeout in milliseconds default is 30secs.
waitUntil:- Used to wait until dom content loaded, load, network idle, etc.