WebDriver provides some basic Browser Navigation Commands that allows the browser to move backwards or forwards in the browser's history.
Managing history of web based application sometime very useful to complete the test case and functionalities.
List of all Navigation Commands in Selenium WebDriver
1> Navigate To Command: This method loads a new web page in the existing browser window. It accepts String as parameter and returns void.
Syntax: to(String arg0) : void
Example: driver.navigate().to("https://sltlearning.blogspot.com/");
2> Forward Command: This method enables the web browser to click on the forward button in the existing browser window. It neither accepts anything nor returns anything.
Syntax: forword() : void
Example: driver.navigate().forward();
3> Back Command: This method enables the web browser to click on the back button in the existing browser window. It neither accepts anything nor returns anything.
Syntax: back() : void
Example: driver.navigate().back();
4> Refresh Command: This method refresh/reloads the current web page in the existing browser window. It neither accepts anything nor returns anything.
Syntax: refresh() : void
Example: driver.navigate().refresh();
😀 TIME TO IMPLEMENT the Same IN YOUR ECLIPSE NOW 😀
Do not Copy, Write Down in Your eClipse for Better Learning 😀
Managing history of web based application sometime very useful to complete the test case and functionalities.
List of all Navigation Commands in Selenium WebDriver
1> Navigate To Command: This method loads a new web page in the existing browser window. It accepts String as parameter and returns void.
Syntax: to(String arg0) : void
Example: driver.navigate().to("https://sltlearning.blogspot.com/");
2> Forward Command: This method enables the web browser to click on the forward button in the existing browser window. It neither accepts anything nor returns anything.
Syntax: forword() : void
Example: driver.navigate().forward();
3> Back Command: This method enables the web browser to click on the back button in the existing browser window. It neither accepts anything nor returns anything.
Syntax: back() : void
Example: driver.navigate().back();
4> Refresh Command: This method refresh/reloads the current web page in the existing browser window. It neither accepts anything nor returns anything.
Syntax: refresh() : void
Example: driver.navigate().refresh();
😀 TIME TO IMPLEMENT the Same IN YOUR ECLIPSE NOW 😀
~~~~~ Time to do Practical Now ~~~~~
- Invoke Chrome Browser
- Navigate to URL: https://sltlearning.blogspot.com/
- Click on the "About SLT Learning" link
- Come back to the Home page using the back command
- Again go back to the About SLT Learning Page using forward command
- Again come back to the Home page using To command
- Refresh the Browser using Refresh command
- Close the Browser
Do not Copy, Write Down in Your eClipse for Better Learning 😀