Why there is a delay/ waiting time, although I didn't set it

Best practices, code snippets for common functionality, examples, and guidelines.
Essramasoud
Posts: 8
Joined: Tue Dec 29, 2015 4:27 pm

Why there is a delay/ waiting time, although I didn't set it

Post by Essramasoud » Tue Dec 29, 2015 4:42 pm

Hello,

I have a list with elements, and i want to scroll down through it until a certain element is visible, so then it will be selected.
I wrote this code:

Code: Select all

     Public Sub ScrolldownUserCodeMethod()
        	Dim i As Integer
        	
       	For i = 1 To 50
        		
           Report.Log(ReportLevel.Info, "Mouse", "Mouse Left Click item 'AdministrationAtQa.FormDesktopContainer.ScrollDownContinuousButton' at 9;4.", repo.AdministrationAtQa.FormDesktopContainer.ScrollDownContinuousButtonInfo,repo.AdministrationAtQa.FormDesktopContainer.ScrollDownContinuousButtonInfo, new RecordItemIndex(1))
           repo.AdministrationAtQa.FormDesktopContainer.ScrollDownContinuousButton.Click("9;4")
      
          
      	    if (repo.AdministrationAtQa.FormDesktopContainer.FirstClassInfo).exists()  Then 
        	  Exit For 
          	End If
      
        Next
           
        End Sub
and it does what I want.

The only problem, is after each click on the scrolling button, I get a waiting time... which slows the test down considerably.

I reduced the search timeout for all the elements in the code, for only 10ms.. and still i get this waiting time...

can you help me know why?

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Why there is a delay/ waiting time, although I didn't set it

Post by Support Team » Wed Dec 30, 2015 9:53 am

Hello Essramasoud,

Ranorex needs to search the needed element on each iteration of your for-loop, and that takes some time. Please do not reduce the search timeout to 10ms. It won’t speed up the search, but rather break the test if the element is not found within 10ms.

Hope this information helps.

Sincerely,
Robert
.
Image

Essramasoud
Posts: 8
Joined: Tue Dec 29, 2015 4:27 pm

Re: Why there is a delay/ waiting time, although I didn't set it

Post by Essramasoud » Wed Jan 06, 2016 1:56 pm

Hello,
I haven't received any answer on this.
Is there a way to fix this?

krstcs
Ranorex Guru
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: Why there is a delay/ waiting time, although I didn't set it

Post by krstcs » Wed Jan 06, 2016 4:26 pm

Robert answered it very clearly the day it was posted.

What question did you ask that wasn't answered?

Please state it again clearly and fully so that we can understand what you are needing help with.


Ranorex requires a certain amount of time to find an element each time it attempts an action on the element, so there will ALWAYS be a delay of some kind. As Robert said, the only thing that will happen when you lower the timeouts too much is that the test will fail more quickly. The timeout does not control how long it takes Ranorex to find an element or to act upon the element, it only tells Ranorex how long to search before it fails due to the element not being found. If you set the timeout to 10ms, Ranorex will not have enough time to find the object before it fails the test with the 'Failed to find object 'xxx' withing the timeout specified' error.

Test automation is NOT about speed but about consistency. Don't try to make it faster than it can handle.
Shortcuts usually aren't...

Essramasoud
Posts: 8
Joined: Tue Dec 29, 2015 4:27 pm

Re: Why there is a delay/ waiting time, although I didn't set it

Post by Essramasoud » Thu Jan 07, 2016 11:24 am

This not the first time for me to run a test on Ranorex!
I know that Ranorex waits for some time until the element is visible, then it executes the action... and I know, exactly, what the search time-out means!

For all actions, I can set the search time-out for each element to fit my needs... and it always works...

In this case, decreasing the search timeout doesn't seem to affect the delay WHATSOEVER!!

Ranorex waits for 10 seconds, before it performs one click, so if it needs to perform 10 clicks, that will take around 100 sec.... and so on!!
Is it normal to take 100 seconds to scroll down 10 elements???

In the code I sent, there is an IF statement, if the element is not found then it will perform a click... it won't fail due to not finding the element.

You can take a look on the code, to verify my point.

So, the question I asked that wasn't answered, is:

Why decreasing the search time-out for this specific element (FirstClass), doesn't affect the search time-out for it???

Is there another factor affecting it?

The automation not being about speed, doesn't justify putting up with slow performance and wasted time!

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

Re: Why there is a delay/ waiting time, although I didn't set it

Post by odklizec » Thu Jan 07, 2016 12:39 pm

Hi,

Decreasing element Search Timeout for a particular element may be not enough, especially if the element xpath consists of multiple elements or rooted folders! Each element/rooted folder in the xpath adds its Search Timeout to element's "Effective Timeout". By decreasing Search Timeout, you only decrease the timeout for the particular element, but not for its parent elements or rooted folders! Take a look at this screenshot...
searchtimeout.png
searchtimeout.png (17.18 KiB) Viewed 1491 times
Even after decreasing the SearchTimeout of User_IPT to "0", the Effective Timeout will be still 1 minute! And so Ranorex will keep searching the element exactly 1 minute until it gave up.

Please follow this link for more details about Search and Effective Timeout...
http://www.ranorex.com/support/user-gui ... rties.html

BTW, if Ranorex finds the element after 10secs or so, it means it simply cannot find (and click) it faster? So decreasing Search or Effective Timeout will not help you at all. Shorter timeouts would only make your tests to fail. What you should consider is to review the xpath for given element. If the xpath is too general (with a lot of "?" or "//" shortcuts, it may take Ranorex longer to find the correct element.
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

Essramasoud
Posts: 8
Joined: Tue Dec 29, 2015 4:27 pm

Re: Why there is a delay/ waiting time, although I didn't set it

Post by Essramasoud » Thu Jan 07, 2016 4:53 pm

Thanks for explaining :)