Methods
page.goto()
Navigates to a URL. Returns true if navigation succeeded, false otherwise.
url: URL to navigate toheaders(optional): Custom HTTP headers to send with the requesttimeout(optional): Navigation timeout in milliseconds (default: varies)
Promise<boolean> - true if navigation succeeded
Examples:
page.url()
Gets the current page URL.
Promise<string> - Current URL
Example:
page.progress()
Gets page load progress as a percentage (0-100).
Promise<number> - Load progress percentage
Example:
page.show()
Brings the page to the foreground, making it visible to the user.
animate(optional): Whether to animate the transition (default:true)
Promise<void>
Example:
page.hide()
Hides the page, removing it from view.
animate(optional): Whether to animate the transition (default:true)
Promise<void>
Example:
page.setUserAgent()
Sets a custom User-Agent string for the page.
userAgent: User-Agent string to set
Promise<void>
Example:
Complete examples
Navigation with verification
Handling redirects
Authenticated navigation
Progress monitoring
Single-page application navigation
Error handling
Related
Waiting
Wait for content after navigation
Events
Monitor navigation events
Page overview
Back to Page API overview