In this article we learn the browser navigation commands in selenium and syntax of that commands.
Navigation Commands In Selenium
Navigation commands in selenium are used to perform different operations such as backward, forward, refresh, etc. in the browser’s history.
The navigate method is present in the WebDriver interface. It returns an object of type Navigation, which is nested interface of WebDriver interface.
We can attain a Navigation object by calling navigate () method on WebDriver object.
Browser Navigation Commands In Selenium WebDriver
1) driver. Navigate().to(“https://www.google.com”);
This method Loads a new web page in the current browser window.
It accepts a String parameter and returns nothing.
2) driver. Navigate (). Back ();
It is used to navigate to the previous page in the browser history.
3) driver. Navigate ().forward ();
It is used to navigate to the next page in the browser history.
4) driver. Navigate (). Refresh ();
This method is used to refresh the current web page.
It performs the same function as pressing F5 in the browser.