Unable to validate time format

Ask general questions here.
Posts: 11
Joined: Tue Aug 21, 2018 1:31 pm

Unable to validate time format

Post by Noah » Tue Oct 16, 2018 8:45 am

I have a scenario where I need to validate time displayed in the application.
Let's say, I created an appointment for a patient(Ex. 11.10pm) so, to validate this time format I use the below format and I'm storing this format
local variable to validate whether the system time matches with the appointment time displayed in the application and now
what happens is if there is a patient created in the application with time (0.51) during midnight below validation gets failed.

patient.appointment= System.DateTime.Now.ToString("dd-MM-yyyy HH:mm:ss");
var app_Time = repo.EnrollAppointment.Appoiment.Time;
Boolean appoint_time_info = app_Time.InnerText.Equals(patient.appointment);
Validate.IsTrue(appoint_time_info, "Validating inner text of Appointment time" +patient.appointment.InnerText.ToString());

Attached screenshot below please find the attachment.
TimeFormat 10-16-2018 1-07-19 PM.jpg
TimeFormat 10-16-2018 1-07-19 PM.jpg (263.31 KiB) Viewed 489 times

User avatar
Ranorex Guru
Ranorex Guru
Posts: 6781
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Unable to validate time format

Post by odklizec » Tue Oct 16, 2018 9:05 am


Could you please post a Ranorex snapshot of the problematic time element? It seems as if the validated time is displayed without leading zero, i.e. 0:51 instead of 00:51? But your used time format expects 00:00:00 time format? So please check the time returned by your app and update the time format accordingly.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration