Friday, October 31, 2014


In this tutorial, We will learn how to go forward to the next web page.


Forward To The Next Web Page


1. Go to "http:// www.facebook. com".

2. Click on forgot password link.

3. Come back to "http:// www.facebook. com".

4. Now forward to the next web page (i.e forgot password page).





import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;

public class SeleniumForward {

 public static void main(String[] args) {

  WebDriver driver = new FirefoxDriver();
  driver.navigate().to("http://  www.facebook. com");
  WebElement element = driver.findElement(By.linkText("Forgot your password?"));
  element.click();
  driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
  driver.navigate().back();
  driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
  driver.navigate().forward();

 }

}