How to handle calendar in Selenium Webdriver and web table

In my recent article I have handled web table and calendar multiple times and in this article, I will show you how you can handle calendar in Selenium Webdriver using table approach.

I will use JQuery Date picker for example and you can take any example because approach will remain same. I will be using findElements methods to find all the dates and then will get the text and will click on the respective date.

I have uploaded video handle calendar in Selenium Webdriver

 

 

Below image is an example of Date picker which is JQuery widget

handle calendar in Selenium Webdriver

 

Approach to handle calendar in Selenium Webdriver

 

Step 1- Click on calendar

Step 2- Get all td of tables using findElements method

Step 3- using for loop get text of all elements

Step 4- using if else condition we will check specific date

Step 5- If date is matched then click and break the loop.

Program to handle calendar in Selenium Webdriver

I am using Selenium 3 in below post so in case you are completely new to Selenium 3 then check out the new firefox with Selenium 3.

 

Hope you have enjoyed the article 🙂 Keep sharing and keep in touch.

32 Comments

  1. Anvesh
  2. Aarti
  3. Piyush
  4. Sid