Explain Browser Navigation in Selenium WebDriver.

Navigate feature of WebDriver allows the test script developer to work with the browser’s Back, Forward, and Refresh controls. The method that is used for this purpose is navigate(). The following is its API syntax:

            WebDriver.Navigation navigate()

Obviously, there is no input parameter for this method, but the return type is the WebDriver. Navigation interface, which contains all of the browser navigation options that help you navigate through your browser’s history.

a.  WebDriver.Navigation interface on which the to() method is used to navigate to a web URL


b.  Navigation’s back() method to emulate our browser’s Back button using the following line of code:


c.  Navigation’s forward() method to emulate our browser’s Forward button using the following line of code:

d.  Following method will reload the current URL to emulate the browser’s refresh (F5 key) action