The navigate method is used to open the specified URL. The navigate command returns the primary resource response.
Multiple redirects will resolve with the first non-redirect response.
Navigate will throw an error if:
- There is an SSL error.
- Invalid URL.
- Timeout exceeding during navigation.
- The remote server is not reachable.
Syntax:
Page.navigate(URL);
Page.navigate(URL, options);
Arguments:
Url:
The string is passed here, and the arg is used to navigate to the page we want.
This should also include the scheme https://.
Options:
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, loaded, network idle, etc.
Example:
Playwright playwright = Playwright.create();
Browser browser = playwright.chromium().launch(new BrowserType.LaunchOptions().setHeadless(false));
Page page = browser.newPage();
page.navigate("http://autopract.com/selenium/upload1/");
So this is how we can use navigate command and other arguments that can be used effectively.
- Log in to post comments