Calendar Handling in Selenium WebDriver | Write Generic Method for Calendar – Date Picker
In this video, I have explained how to write Generic Method for Date Calendar using Selenium.
Calendar Handling in Selenium WebDriver | Write Generic Method for Calendar – Date Picker
~~~Subscribe to this channel, and press bell icon to get some interesting videos on Selenium and Automation:
Follow me on my Facebook Page:
Let's join our Automation community for some amazing knowledge sharing and group discussion on Telegram:
Naveen AutomationLabs Paid Courses:
Java & Selenium:
Java & API +POSTMAN + RestAssured + HttpClient:
Naveen, I guess, we can directly use sendkeys to that element(since it has an input HTML tag) by sending the text in the required date format. What’s your take on this?
It’s not always true with all the calendars. This is just a demo site where it’s allowed.
Hi, Naveen Awesome Explanation .I have small question I performed this for previous month but only one month back can we use same Generic Logic for previous date ,month, year. Thanks in advance.
Very sorted logic where all possible conditions tested ?, now we can create a backdate selector logic after watching this ?
Crisp and simple explanation ?..awaiting for your next efforts..thanks a lot Naveen ji?
Amazing logic..I was struggling with calenders for quite sometime.. thanks a lot!!!
You missed the previous month/year date selection condition, having the provision to Select the previous year/month date condition is more important from tester point of view because generally we create our own test data so wrong date condition generally didn’t applied for us.
Please share the logic in case if you found the solution. I am struggling to write the generic code for prev years
Thanks a lot Naveen -Great to learn how to handle calendar handling with corner cases. How to handle the past date?
Say we don’t want someone to select past date ,I mean today is 2 march and u don’t want someone to select march 1 and lesser dates, then we can build below logic to compare current date and date given by user
Format formatter = new SimpleDateFormat(“dd-MMMM-yy”);
Which ll give date in this format 02-March-2021
And we have to construct Date object using user input using string to date formatter,using same date month format then compare them using todaysDate.isAfter(dateGivenByUser) this ll return true if user has given past date so we can add logical condition to skip our execution
NOTE:- I didn’t execute this logic ,open for suggestions if am wrong somewhere and I ll be posting my findings after execution
This is really a good question. @Naveen : Could please throw some light on it ? How to handle past date ?
Hey Naveen bro firstly Thankyou so much and as u said I have completed the assignment using goibibo and it’s working with ur method and successful. ##keep smiling and share more & more ?
One more concept added to the playlist?.Thanks Naveen Sir
Anytime ?
Naveen, Yesterday saw this video and today got the same assignment in my project!! It worked!! Thanks a lot ☺️
Good to know that. Glad it helped you ?
How do we handle previous year calendar values (In case of providing Date of birth details).
Example DOB : 07-02-1989
Current calendar by default shows the current date, so I need to keep clicking on prev button and start comparing both year and month.
Is there a generic way to handle this condition please let me know
Great explanation ? ?
Could you please do a video about calendar. previous month or find out after exact 15 days from current date and select particular date and ensure rest of 14 days are disabled.
Hi Naveen, Nice video but i have one doubt for this logic
it would fail if pass date – ’31 June 2022′ or ’31 November 2022′
Thank you so much Sir, Good explanation
What if month and year are in drop-down,
Which approach I should use, please suggest.
Naveen please show how to sort date accending to descending and vice versa
Hey Naveen. Thanks for all the vedios. Really helpful to gain in depth knowledge. Your way of explaining the concept is incredible.
Just one doubt in this vedio of calendar handling. How to handle leap year??? Should I divide the year to be selected by 4 & use this logic to identify leap year & move further?
Thanks in Advance. ?
Nice Naveen for career future,.U are amazing person to teach small small things all of us..Thank you so much for career guidance ?
Glad that u liked it
Thanks alot naveen sir.just one doubt, what if this calendar is of DOB and user wants to select sometimes past sometimes future dates dynamically?
Great explanation sir. Thanks.
Please reply.