In this Example, we will Use https://www.makemytrip.com/flights/ as a target Destination.
Step 1: Variable Initialization
Store the Date of Departure & MakeMyTrip website URL Along with variables which we are going to use for segregation Date, Month, Year.
Step 2: Segregation
Segregate values of Date, Month, Year Component from the DatePicker Variable using Assign operation.
Step 3: Launch Website
Drag “ Open Browser” Activity into the Design Panel and Populate code as given below
We will be using “ Click” Activity twice pointing to Departure Field,
Need of Using Click Activity Twice is 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 , We are clicking in Departure Field again.
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 as depicted below.
Now the extraction begins, select “Assign “activity to segregate Month & Year extracted using “Get Text” activity.
Step 5: Iteration
Drag “ While “ Activity to Iterate and replicate the below code:
Condition to be used : not(vYear=vURLYear) or not(vMonth=vURLMonth)
Then Use “Click” activity on Arrow Element to span across target month 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 ‘August 2020’, We will Use Wild card here which in turn be like ‘* 2020’ and the rest remains same
By now, Bot will iterate and sets our target Month (ex: Target Month is November). Once Target Month and Target Year is achieved, bot comes out of While Loop.
Complete Skeleton of while Operation:
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 vDate variable as shown above. Then click on “Edit Selector” and select a Date field from the calendar as depicted below.
For Example, Lets take August 26th from the calendar,
We will get index value as Date in selectors,
Now Since we want to achieve our target Date , lets implement Dynamic selectors, Got to Index value.
a.Perform a Right click.
b.Pop-Up Box appears as depicted below
c. Since We already have our Target Date assigned to a variable, we will click on “Choose Variable” Option.
d.Choose vDate from the option.
e.Result is depicted as below
That’s It! You have successfully completed automating Date Picker, Hit Save & Run.
Click here to download the “Source Code”
You can connect with Vinodh Parameswaran, he is always happy to help 🙂