Seach Timout Duration not working as expected

Ask general questions here.
stapes
Posts: 206
Joined: Wed Sep 16, 2015 10:55 am

Seach Timout Duration not working as expected

Post by stapes » Thu Jan 28, 2016 4:02 pm

In the following code, I am expecting to wait up to 20 seconds to find a control.
This is not happening. It waits a lot longer than 20 seconds.
When I put a stopwatch in, it took 138869 ms to fail.

Am I missing something?

Code: Select all

 Report.Info("Date of Birth.","Checking for 'Done' button. If not found, Fail test.");
			Duration searchTimeout = new Duration (20000); //Timeout in ms
			repo.IOS365Agile.Com365agileEnterprise365AgileTEST.Root.DoneInfo.SearchTimeout = searchTimeout ;
			bool Found=repo.IOS365Agile.Com365agileEnterprise365AgileTEST.Root.DoneInfo .Exists ();
			
			if(Found)
			{
				Report .Info ("Info","'Done' button found.");
				repo.IOS365Agile.Com365agileEnterprise365AgileTEST.Root.Done.Touch();
			}
			else
			{
				Report.Failure ("Fail","IOS Form Date of Birth field. Done button not found.");
			}

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

Re: Seach Timout Duration not working as expected

Post by odklizec » Thu Jan 28, 2016 4:42 pm

Hi,

Decreasing SearchTiemout is not enough, because it decreases the SearchTimeout of given element, which is, in your case, "Done" element. The SearchTimeout of each other element in the path remains intact (most probably default 30sec). Ranorex always search for the pointed element using sum of all SearchTimeouts, which in your case is 30+30+30+30+20=140sec=140000msec
repo(30).IOS365Agile(30).Com365agileEnterprise365AgileTEST(30).Root(30).Done(20). Your measured 138869msec is pretty close to 140000msec ;)

What you are looking for is decreasing EffectiveTimeout, but I'm not quite sure there is a way to do this? Anyway, the easiest solution of your problem is using Element.Exists(timeout) where you simply replace timeout parameter with value of your choice.

Please follow this post about about difference between SearchTiemout and EffectiveTimeout..
http://www.ranorex.com/forum/why-there- ... tml#p36008
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

stapes
Posts: 206
Joined: Wed Sep 16, 2015 10:55 am

Re: Seach Timout Duration not working as expected

Post by stapes » Thu Jan 28, 2016 4:54 pm

Thanks oddklizec, but I am not sure I understand that.

You suggest using Element.Exists(timeout). I thought I was - in this line:

Code: Select all

bool Found=repo.IOS365Agile.Com365agileEnterprise365AgileTEST.Root.DoneInfo .Exists ();

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

Re: Seach Timout Duration not working as expected

Post by odklizec » Thu Jan 28, 2016 5:00 pm

Hi,

In your line, there is not used timeout parameter in Exists method! If used, it will search for given element only the specified amount of time. Which means it basically overrides the EffectiveTimeout.

Your application of new SearchTimeout only decreased the SearchTimeout (not EffectiveTimeout) of 'Done' element. SearchTimeout of repo, IOS365Agile, Com365agileEnterprise365AgileTEST and Root element remained intact!
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