Saturday, April 18, 2020

Selenium WebDriver - Navigation Commands

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 😀



~~~~~ Time to do Practical Now ~~~~~



  1. Invoke Chrome Browser
  2. Navigate to URL: https://sltlearning.blogspot.com/
  3. Click on the "About SLT Learning" link 
  4. Come back to the Home page using the back command
  5. Again go back to the About SLT Learning Page using forward command
  6. Again come back to the Home page using To command
  7. Refresh the Browser using Refresh command
  8. Close the Browser  

Do not Copy, Write Down in Your eClipse for Better Learning  😀





No comments:

Post a Comment