package com.seleniumWebdriver;
import org.openqa.selenium.By;
import org.testng.annotations.Test;
/**
* @Blog Name : Selenium Code Example
* @author Deepak Gupta
* @Created Date 8-08-2017
*
*/
public class NavigateBrowser extends SuperTestNG {
@Test
public void handleNavigateBrowser() {
try {
driver.get("https://jqueryui.com/datepicker/");
System.out.println("Current URL is: " + driver.getCurrentUrl());
driver.findElement(By.linkText("Autocomplete")).click();
Thread.sleep(2000);
System.out.println("After Clicked Link Current URL is: " + driver.getCurrentUrl());
// browser back
driver.navigate().back();
System.out.println("After Navigate Back Current URL is: " + driver.getCurrentUrl());
Thread.sleep(2000);
// browser forward
driver.navigate().forward();
System.out.println("After Navigate Forword Current URL is: " + driver.getCurrentUrl());
Thread.sleep(2000);
// refresh page
driver.navigate().refresh();
Thread.sleep(2000);
} catch (Exception e) {
e.printStackTrace();
}
}
}
import org.openqa.selenium.By;
import org.testng.annotations.Test;
/**
* @Blog Name : Selenium Code Example
* @author Deepak Gupta
* @Created Date 8-08-2017
*
*/
public class NavigateBrowser extends SuperTestNG {
@Test
public void handleNavigateBrowser() {
try {
driver.get("https://jqueryui.com/datepicker/");
System.out.println("Current URL is: " + driver.getCurrentUrl());
driver.findElement(By.linkText("Autocomplete")).click();
Thread.sleep(2000);
System.out.println("After Clicked Link Current URL is: " + driver.getCurrentUrl());
// browser back
driver.navigate().back();
System.out.println("After Navigate Back Current URL is: " + driver.getCurrentUrl());
Thread.sleep(2000);
// browser forward
driver.navigate().forward();
System.out.println("After Navigate Forword Current URL is: " + driver.getCurrentUrl());
Thread.sleep(2000);
// refresh page
driver.navigate().refresh();
Thread.sleep(2000);
} catch (Exception e) {
e.printStackTrace();
}
}
}
No comments:
Post a Comment