WebDriver provides some basic Browser Navigation Commands that allows the browser to move backwards or forwards in the browser's history. To access the navigation's method, just type driver.navigate(). The IntelliSense feature of the eclipse will automatically display all the public methods of Navigate Interface shown in the below image.
Note: The Methods having "Navigation" (highlighted in yellow color) as keyword are declared as Navigation commands.
1. Navigate To Command
to(String arg0) : void
This method loads new web page in the current browser window. It accepts String as parameter and returns void.
Command - driver. navigate().to(url);
Note: The get command driver. get(url); which is browser command does the same function as the navigate to command.
2. Froward Command
forward() : void
This method does the same operation as clicking on the Forward button in the existing browser window. It neither accepts anything nor returns anything.
Command - driver. navigate().forward();
The respective command that takes you forward by one page on the browsers history
3. Back Command
back() : void
This method does the same operation as clicking on the Back button in the existing browser window. It neither accepts anything nor returns anything.
Command - driver. navigate().back();
It takes you back by one page on the browser history.
4. Refresh Command
refresh() : void
This method refresh the current page. It neither accepts anything nor returns anything.
Command - driver. navigate().refresh();
It does same function as F5 in the browser.
Comments