package com.seleniumWebdriver;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.testng.annotations.Test;
/**
* @Blog Name : Selenium Code Example
* @author Deepak Gupta
* @Created Date 4-08-2017
*
*/
public class CalendarPopup extends SuperTestNG {
public void handleFrame() {
WebElement ele = driver.findElement(By.className("demo-frame"));
driver.switchTo().frame(ele);
}
@Test
public void handleCalendarPopup() {
try {
driver.get("https://jqueryui.com/datepicker/");
handleFrame();
driver.findElement(By.id("datepicker")).click();
driver.findElement(By.xpath("//a[text()='20']")).click();
String value = driver.findElement(By.id("datepicker")).getAttribute("value");
System.out.println("Selected Date is : " + value);
Thread.sleep(2000);
} catch (Exception e) {
e.printStackTrace();
}
}
}
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.testng.annotations.Test;
/**
* @Blog Name : Selenium Code Example
* @author Deepak Gupta
* @Created Date 4-08-2017
*
*/
public class CalendarPopup extends SuperTestNG {
public void handleFrame() {
WebElement ele = driver.findElement(By.className("demo-frame"));
driver.switchTo().frame(ele);
}
@Test
public void handleCalendarPopup() {
try {
driver.get("https://jqueryui.com/datepicker/");
handleFrame();
driver.findElement(By.id("datepicker")).click();
driver.findElement(By.xpath("//a[text()='20']")).click();
String value = driver.findElement(By.id("datepicker")).getAttribute("value");
System.out.println("Selected Date is : " + value);
Thread.sleep(2000);
} catch (Exception e) {
e.printStackTrace();
}
}
}
No comments:
Post a Comment