Calendar Date Picker Handle using Selenium :

 

  • Calendar Date Picker is just a like a table with set of rows and columns with numbers.
  • To select a date from calendar we just have to navigate to the cell where our desired date is present and perform operation on cell.
  • We always see some input boxes, where we need to pick dates from the calendar / Date picker widget.
  • When we click on that input box, a calendar / Date picker widget is open and we have to choose the appropriate date value from that widget.
  • I am using the findElements method to search all the dates.
  • I will receive the text and click on the Expected date.
  • Sometimes Calendar / Date picker code within iFrame so, that time we have need to handle iFrame.
  • First switchTo iFrame then handle Cell data using tr (Table row) and td (Table Data).

 

Scenarios :

  1. Launch Browser.
  2. Open URL.
  3. If Calendar / Date Picker into iFrame then switchTo into iFrame.
  4. Identify table using ID where we want to click on calendar / Date picker.
  5. Read all tr (Table row) and td (Table Data).
  6. Read each and every cell record.
  7. Compare / Verify every Actual cell (Date) record with Expected cell (Date).
  8. If found Expected cell (Date) within table then click on that Cell (Date).

 

Example : Calendar Date Picker Handle using Selenium: