In this Example, we will use https://www.makemytrip.com/flights/ as a target Destination.
Step 1: Variable Initialization
Store the MakeMyTrip website URL Along with variable which we are going to use for segregation Date, Month, Year.
We will also use Input Dialog box to take the Departure date from the user.
Step 2: Segregation
Segregate values of Date, Month, Year Component from the DatePicker Variable using Assign operation.
Step 3: Launch Website
Drag “ Use Application/Browser” Activity into the Design Panel and Populate code as given below
We will be using “ Click” Activity twice pointing to Departure Field because while Automating initially we will receive Login-Pop up. Just By Clicking its being handled and for latter in order to select our target date.
Calendar Picker Opens up Post using “Click activity” twice .
Step: 4 Extract TimeStamp
Drag “Get Text” activity and indicate the element to be extracted on current Month and Year as depicted below.
Now the extraction begins, select “Assign “activity to segregate Month & Year extracted using “Get Text” activity.
vURLYear : vURLDateStamp.Substring(vURLDateStamp.Length-4,4).Trim
Step 5: Iteration
Drag “ While “ Activity to Iterate and replicate the below code:
Condition to be used : not(strYear=vURLYear) or not(strMonth=vURLMonth)
Then Use “Click” activity on Arrow Element to span across target month &year in the body of while Loop:
Next, Just Copy previous Get Text & Assignment activity and paste them below “ Click” Activity.
Only Minor Change to be done in “ Get Text” Activity, In Which we would have element known as “aa Name” with value * ,we will Use Wild card here along with the year variable (strYear) and the rest remains same.
Complete Skeleton of while Operation:
By now, Bot will iterate and sets our target Month & Year .Once Target Month and Target Year is achieved, bot comes out of While Loop.
Step 6: Set Date
We need to set date Post achieving Target Month &Year, Here We will use Dynamic selector to achieve the result.
Drag “Click Text” Activity and set strDate variable as shown above. Then click on “Edit Selector” and select a Date field from the calendar.
That’s It! You have successfully completed automating Date Picker, Hit Save & Run.