Next-Gen App & Browser
Testing Cloud

Trusted by 2 Mn+ QAs & Devs to accelerate their release cycles

Next-Gen App & Browser Testing Cloud

What are the different types of navigation commands in WebDriver?

WebDriver's driver.navigate() method provides some basic Browser Navigation Commands, such as back() and forward(), that allows the browser to move backward or forwards in the browser's history. Just like other WebDriver methods, we can also access these navigation methods by typing driver.navigate() in the Eclipse panel.


  • Navigate to Command:
  • This method loads a new web page in the existing browser window. It accepts String as a parameter and returns void. The respective command can be written as:

    driver.navigate().to("www.lambdatest.com");
  • Forward Command:
  • In WebDriver, the clickForward() method enables you to click on the forward button in an existing browser window. It does not accept any arguments and does not return any value. The following command takes you forward by one page in the browser's history:

    driver.navigate().forward();
  • Back Command:
  • You can use the command WebDriver.get() to go backward by one page on the browser's history. This method allows you to click on the back button in the existing browser window. This method neither accepts anything nor returns anything. This syntax for this command is as follows:

    driver.navigate().back();
  • Refresh Command:
  • The WebDriver's refresh method reloads the current web page in the existing one. The syntax for the command is as follows:

    driver.navigate().refresh();

Test Your Website on 3000+ Browsers

Get 100 minutes of automation test minutes FREE!!

Test Now...

KaneAI - Testing Assistant

World’s first AI-Native E2E testing agent.

...
ShadowLT Logo

Start your journey with LambdaTest

Get 100 minutes of automation test minutes FREE!!

Signup for free