Navigating through a site
If you look at how you navigate through different pages on a browser, there are basically four ways:
- You type a URL in the address bar or using a bookmark.
- You use the browser functions to go back, forward, or reload a page.
- You click on elements on a page.
- The site you are browsing redirects to another page.
The goto
function emulates the first option, navigating to a site. We use that to navigate to the page we want to test:
await this.page.goto(this.config.baseURL + 'login');
Now, guess what? The goto
signature isn't goto(url)
but goto(url, options)
. You will see this pattern being repeated over and over – a function with one or more required arguments (or none), and then a set of extra options.
Luckily for us, the options goto
expects is not as big as the one we saw in the launch
options. It only has three options:
timeout
: Maximum navigation time in milliseconds.waitUntil
: When to...