Hi,
I have used WaitForExist/NotExist() function quite extensively across my test automation.
Is there any easy way to record time it took start waiting for an element appear or disappear until element successfully finishes waiting for exist/notexist?
Code looks like this:
private Duration WaitTimeOut(string seconds)
{
double secs = double.Parse(seconds);
return TimeSpan.FromSeconds(secs);
}
repo.PaymentSenseLTDHomeArea.KOverlayInfo.WaitForNotExists(WaitTimeOut(PageTimeout));
And I am passing wait time (PageTimeout) from dataSource connection, so that I can control waiting globally across all tests.
Now I am thinking it would be nice to log actual time it took in waiting. Is there is any simplest way to do it without adding too much code?
WaitForExist()
Re: WaitForExist()
You could wrap the WaitForExist/NotExist() call with two data-time stamps and subtract the first from the second. It will be a little rough, but should do the trick.
Code: Select all
System.DateTime start = System.DateTime.Now;
//do stuff here
TimeSpan waitTime = System.DateTime.Now.Subtract(start);
Shortcuts usually aren't...
Re: WaitForExist()
Thanks,
simple3 line code works brilliant
I was stupid made it complicated adding a function wait sleep while time etc,,,,
simple3 line code works brilliant
I was stupid made it complicated adding a function wait sleep while time etc,,,,
Re: WaitForExist()
Hehe, I find myself making things more complicated than I should way more often than I like.
You're welcome!
You're welcome!
Shortcuts usually aren't...