Selecting Date from Calendars(WebDriver) - Bug Reaper

                  Bug Reaper

Lean about Automation Testing,Selenium WebDriver,RestAssured,Appium,Jenkins,JAVA,API Automation,TestNG,Maven, Rest API, SOAP API,Linux,Maven,Security Testing,Interview Questions

Monday 23 September 2013

Selecting Date from Calendars(WebDriver)

Calendar now = Calendar.getInstance();
   
            System.out.println("Current Year is : " + now.get(Calendar.YEAR));
  
            //month start from 0 to 11
    System.out.println("Current Month is : " + (now.get(Calendar.MONTH) + 1 ));
    System.out.println("Current Date is : " + now.get(Calendar.DATE));
   
now.add(Calendar.DATE, 51);
int dayOfMonth = now.get(Calendar.DAY_OF_MONTH);
driver.findElement(By.linkText("" + dayOfMonth)).click();

No comments:

Post a Comment