package navigateBack;
import org.testng.annotations.Test;
import org.testng.annotations.BeforeClass;
import java.sql.Driver;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.annotations.AfterClass;
public class NewTest {
WebDriver driver;
String url1=“Http://www.baidu.com”;
String url2=“http://www.sogou.com”;
@Test
public void test() throws InterruptedException {
driver.navigate().to(url1);
Thread.sleep(3000);
driver.navigate().to(url2);
Thread.sleep(3000);
driver.navigate().back();
Thread.sleep(3000);
driver.navigate().forward();
Thread.sleep(3000);
driver.navigate().refresh();
}
@BeforeClass
public void beforeClass() {
System.setProperty(“webdriver.chrome.driver”, “E:\chromedriver.exe”);
driver=new ChromeDriver();
}
@AfterClass
public void afterClass() {
driver.quit();
}
}