Search code examples
javaseleniumdatedatepickerwebdriver

Unable to navigate the datepicker in a Mercurytravels.co.in website


I am looking at suggestions to navigate through the datepicker in the https://www.mercurytravels.co.in/flights application (i'm new to selenium). I would like to pass the date in "DD/MM/YYYY" format and then be able to select the date from the "Date of Journey" date picker element.

Any suggestions/recommendations on how it would be possible to select a specific date in coming months from the date element?


Solution

  • Please use SImpleDateFormat java lib for formatting the date.

    SimpleDateFormat st = new SimpleDateFormat("dd/MM/yyyy");
    st.setTimeZone(TimeZone.getTimeZone("GMT"));
    return st.format(new Date());