We have seen Handling of calendar of one type in last post.
Adding to it, in this post we will see handling of calendar which has year and month as drop-downs.
A calendar which has year and month has drop-downs looks as below:
User needs to select year followed by month and day. This type of calendar is mostly used across applications as it provides a broader range. This calendar can be used to take input for date of birth etc.
Let’s see how can we handle this type of calendar in Selenium.
- You must be aware how to handle drop-downs in selenium. If not, don’t worry. Refer below posts:
- You need to select desire year first from drop down.
- You need to wait till months are loaded in month’s drop down.
- Select desire month from month drop down.
- Now select desired day from calendar.
Selected Date: 09/23/2018
- You can customize above logic as per your requirement.
- You can create a reusable method to select date.
- You can also add some validation if desired year/month/day is not valid/available.
Hope above must must have helped you.
If you have any doubt, feel free to ask here.
If you like my posts, please like, comment, share and subscribe.