About Me

Page views

Powered by Blogger.

Followers

Wednesday 29 April 2015


To Command

driver.navigate().to("https://in.yahoo.com/");

Purpose : This command is use to navigate on specific page or URL in between the  test Command : driver.navigate().to(URL); Parameters : url – The URL to load. It is best to use a fully qualified URL

Forward Command

driver.navigate().forward();


Purpose : This command is use to go on to next page like browser’s forward button.

Back Command

driver.navigate().back();

Purpose : This command is use to go back to previous page like browser’s back button.

Refresh Command

driver.navigate().refresh();

Purpose : This command is use to refresh the current page.

Practice Yourself


package dayOne;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class NavigationCommands {
private static WebDriver driver = null;
public static void main(String[] args) {
// Create a new instance of the Firefox driver
driver = new FirefoxDriver();
// Open ToolsQA website
driver.get("http://www.bbc.com/");
// Put an Implicit wait on driver
        driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
// Click on About link
        driver.findElement(By.linkText("Earth")).click();
// Go back to Home Page
driver.navigate().back();
// Go forward to About page
        driver.navigate().forward();
         // Go back to Home page
        driver.navigate().to("http://www.bbc.com/");
  // Refresh browser
  driver.navigate().refresh();
  // Close browser
  driver.close();

}
}

1 comment:

  1. Appreciating the persistence you put into your blog and detailed information you provide.

    Selenium Training in chennai | selenium

    ReplyDelete

Popular Posts

Copyright © Learn Selenium Yourself | Powered by Blogger
Design by Duan Zhiyan | Blogger Theme by NewBloggerThemes.com