Navigation Method in Selenium Webdriver

Navigation Methods in Webdriver with Examples

navigate().to(String)


driver= new FirefoxDriver();
driver.navigate().to("http://www.google.com");

navigate().back()


driver= new FirefoxDriver();
driver.navigate().to("http://www.google.com");
driver.naviagte().back()

navigate().forward()


driver= new FirefoxDriver();
driver.navigate().to("http://www.google.com");
driver.naviagte().forward()

navigate.refresh()


driver= new FirefoxDriver();
driver.navigate().to("http://www.google.com");
driver.naviagte().refresh

 selenium code for navigation command using Java



package New;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class AutomationTesting {

public static void main(String[] args
{
             
System.setProperty("webdriver.chrome.driver","D:\\Sandeep\\Soft\\chromedriver.exe");
              WebDriver driver= new ChromeDriver();
              driver.navigate().to("https://qaacharya.com/");
              driver.manage().window().maximize();
              driver.findElement(By.linkText("Testing Concepts")).click();
              driver.navigate().back();
              driver.navigate().forward();
              driver.navigate().refresh();
              driver.close();

       }
}

Hope the above tutorial of navigation method in selenium webdriver helpful for you ...
Team
QA acharya

Tags :Navigation command in selenium ,Webdriver navigation method , types of navigation methods in selenium