Unable to validate time format

Ask general questions here.
Noah
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

Hello,
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.
You do not have the required permissions to view the files attached to this post.

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7470
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

Hi,

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