Am trying to automate a date picker,on clicking the ok button date should be displayed in date box.I have two date pickers like for a start date and the other is for the end date.One date picker is registering the date but the other date picker is not registering the date,neither i get any error.Please help,it's urgent.Here is my code..
package DatePicker;
import java.util.List;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
public class DatePickerTest
{
WebDriver driver;
Actions builder;
@BeforeMethod
public void setup()
{
System.setProperty("webdriver.chrome.driver", "C:\\chromedriver.exe");
driver = new ChromeDriver();
driver.manage().timeouts().implicitlyWait(10,TimeUnit.SECONDS);
driver.get("http://localhost/able/public/index.php/get_inputs");
driver.manage().timeouts().implicitlyWait(10,TimeUnit.SECONDS);
System.out.println("Hello client");
}
@Test
public void TestDate() throws Exception
{
WebDriverWait wait=new WebDriverWait(driver,3);
Boolean invisible=wait.until(ExpectedConditions.invisibilityOfElementLocated(By.className("preloader")));
if(invisible)
{
driver.findElement(By.xpath("//*[@id=\"add-edit-form\"]/div[3]/div[1]")).click();
}
Thread.sleep(2000);
WebElement web11=driver.findElement(By.className("dtp-btn-ok"));
web11.click();
Thread.sleep(2000);
driver.findElement(By.id("Contract_e_date")).click();
Thread.sleep(1000);
builder= new Actions(driver);
//Thread.sleep(1000);
WebElement web2=driver.findElement(By.className("dtp-btn-ok"));
//Thread.sleep(1000);
builder.moveToElement(web2).click(web2);
//web2.click();
Thread.sleep(1000);
builder.perform();
}
}