Continuous Test Orchestration And Execution Platform Online

Perform automated and live-interactive testing on 3000+ real desktop and mobile devices online.

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();
LambdaTest

Test your websites, web-apps, or mobile apps seamlessly with LambdaTest.

Start Free Testing
LambdaTest

Earn resume-worthy Selenium certifications that help you land a top job.

Learn More
LambdaTest

Test your web or mobile apps

Test orchestration and execution cloud of 3000+ browsers and OS

Support

24/7 support

Security

Enterprise grade security

Cloud

Fastest test execution cloud