Example Programs

1. Back and Forward navigation

package com.SeleLearning;



import org.openqa.selenium.By;

import org.openqa.selenium.WebDriver;

import org.openqa.selenium.firefox.FirefoxDriver;



public class Test {



 public static void main(String[] args) throws InterruptedException {

  

  WebDriver driver = new FirefoxDriver();

  driver.get("http://seleniumhq.org/");

  driver.findElement(By.linkText("Download")).click();

  Thread.sleep(3000); // delay

  driver.navigate().back();

  driver.navigate().forward();

 }

}

2.

0 comments