If you have calendar which have Month and Year drop-downs and date in tags then follow below code to select the date from the calendar


HtmlImage calImage = new HtmlImage(browser);
cal.SearchProperties.Add(“Id”, “ImageID”); //It finds the ‘V’ image of calendar to open.
Mouse.Click(cal); //It opens the calender.
HtmlComboBox Month = new HtmlComboBox (browser);
Month.SearchProperties.Add(“Id”, “MonthDropDownID”); //It finds the Month drop-down field.
Month.SetProperty(“SelectedItem”, “December”); //It selects provided Month in drop-down field.
HtmlComboBox Year = new HtmlComboBox (browser);
Year.SearchProperties.Add(“Id”, “YearDropDownID”); //It finds the Year drop-down field.
Year.SetProperty(“SelectedItem”, “2015”); //It selects provided Year in drop-down field.
HtmlTable Calender = new HtmlTable(browser);
Calender.SearchProperties.Add(“Id”, “CalenderTableID”); //It finds the Calender table.
HtmlCell date = new HtmlCell(Cal);
date.SearchProperties.Add(“InnerText”, “31”); //It find provided date by InnerText.
Mouse.Click(date); //It selects provided Date from the Calender.


Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s