Navigation Commands in Selenium :


  • Using Selenium Navigation Commands able open a web page URL, navigate to other web page by clicking any element, Back, Forward or Refresh the web page using browser’s history.
  • Using the navigating interface is able to move back and forward in browser history.


Navigate To Command:

  • “navigate().to()” : This command is like the get() command.
  • It opens a new browser window and it will receive / find the page you provided.
  • Able to redirect from the current web page to the expected web page.


Forward Command:

  • “navigate().forward()” : A page leads you to the history of the browser.
  • Navigate (). Move forward page using the Forward () command.


Back Command:

  • “navigate().back()” : This command is used to return to a page in the browser’s history.
  • Navigate (). Use the back () command to go to the backward page.


Refresh Command:


  • “navigate().refresh()” : This command is used to refresh the current page.
  • Refresh the current page if there is a change in the web page at times.


Navigation Commands in Selenium Steps :

  • Set geckodriver path to launch browser.
  • Create a instance of FirefoxDriver() to handle Navigation commands.
  • Navigate to URL.
  • Wait until Page Load.
  • Navigate to another URL.
  • Navigate to back page.
  • Navigate to forward page.
  • Refresh current page.


Example of Navigation Commands: