CodedUI test should select the todays date whenever the test runs.

Category: visual studio test

Question

Russel Michael on Fri, 23 May 2014 12:57:12


Hi All,

I have got a scenario where I want to perform a CodedUI test and the test should pick the todays date whenever the test runs on the application. 

and also the Time which should be 4:30 hours past of the System time. 

Pls suggest

Replies

Starian chen on Mon, 26 May 2014 02:29:25


Hi Russel,

For this requirement, please refer to this code below:

System.DateTime d = DateTime.Now;
            d.AddHours(-4);
            d.AddMinutes(-30);
HtmlEdit editControl=[set your control];
editControl.Text=d.ToString();

Thanks

Best Regards