The navigation commands are related to what a user does when he/she interacts with the browser and goes to a previous page, refreshes a page, or browses to a given URL. The navigation interface provides the ability to perform these actions.
The WebDriver class provides the WebDriver.Navigation navigate() method to navigate to URLs during the execution of a script. It returns the browser's history and allows you to navigate to any given URL. The interface includes methods to navigate. The following are some examples of how this method is used:
- navigate().back(): This goes to the previous page in the browser history
- navigate().forward(): This moves forward to the next page in the browser history
- navigate().refresh(): This reloads the current page
- navigate().to("http://www.yahoo.com"): This browses to an indicated URL