Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Selenium WebDriver Browser (Navigation) Commands:-

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 596
    Comment on it

    Navigation commands are used to navigate from one web page to another web page that we deal with. Below are some basic Navigation commands which are commonly used while writing the test scripts in Selenium.


    1) Navigate To Command - "navigate().to()" : navigate().to() command is used to navigate user to another web application.


    2) Navigate Refresh Command - "navigate().refresh()" : navigate().refresh() command is used to refresh the current page.


    3) Navigate to back page - "navigate().back()" : navigate().back() command is used to navigate user one page back from the browser's history.


    4) Navigate to forward page - "navigate().forward()" : navigate().forward() is used to navigate user one page forward from the browser's history.


    The code/snippet goes as below:


    import org.openqa.selenium.WebDriver;
    import org.openqa.selenium.firefox.FirefoxDriver;
    
    public class NavigateCommands {
    
    public static void main(String[] args) {
        // TODO Auto-generated method stub
      WebDriver driver = new FirefoxDriver();
    
      driver.get("http://google.com");
    
      driver.navigate().to("http://findnerd.com");
    
      driver.navigate().back();
    
      driver.navigate().forward();
    
      driver.navigate().refresh();
    }
    
    
    }

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: