private void DateCalcAddBusinessDays() { System.DateTime curdate, result; string txtresult, calcresults; curdate = System.DateTime.Now; frm.MainForm.Tools.Click(); Delay.Seconds(1); frm.MainForm.DateCalculator.Click(); if (frm.DateCalculatorForm.SelfInfo.Exists(3000)) { Report.Success("Date Calculator Form is opened successfully"); //frm.DateCalculatorForm.PnlBase.txtDays.PressKeys(curdate); frm.DateCalculatorForm.PnlBase.txtDays.PressKeys("10"); frm.DateCalculatorForm.PnlBase.btnCalculate.Click(); result = cmn.AddBusinessDays(curdate, 10); txtresult = result.ToString("ddd MMMM dd, yyyy"); Delay.Seconds(2); calcresults = frm.DateCalculatorForm.PnlBase.txtResult.GetAttributeValue <String>("UIAutomationValueValue"); if (txtresult.Contains(calcresults)) { Report.Success(String.Format("Calculated days for 10 business days {0} is as expected", txtresult)); } else { Report.Failure(String.Format("Calculated days for 10 business days {0} is not as expected and the result shown is {1}", txtresult, calcresults)); } frm.DateCalculatorForm.Toolbar1.btnOK.Click(); } }