FindSingle how it really works?

Class library usage, coding and language questions.
i.vasilyev
Posts: 30
Joined: Fri Sep 09, 2016 10:14 am

FindSingle how it really works?

Post by i.vasilyev » Wed May 03, 2017 3:14 pm

Hello. I have following question.

I want to know how FindSingle really works.

Env:
- Win 10
- Ranorex 6
- Desktop app

Can somebody explain that thing in case of following examples:
Ex #1:

Code: Select all

SomeBtn.Click();//That click opens form "MyForm". The form opens but it is freezed for 20 sec
Host.Local.FindSingle<Button>("/form[@class='MyForm']/Button[@class='BestClass']", Duration.FromMilliseconds(30000));
How many times will Ranorex try to re-search the button(BestClass)?

Ex #2:

Code: Select all

SomeBtn.Click();//That click opens form "MyForm". The form opens but it is freezed for 20 sec
Host.Local.FindSingle<Button>("/form[@class='MyForm']/Button[@class='BestClass']", Duration.FromMilliseconds(10000[));
How many times will Ranorex try to re-search the button(BestClass)?
As I understand the form is present, but it has property Valid = false, the same for button(BestClass). Is my assumption true? Would Ranorex clicks on button when form is freezed or it will wait?

How FindSingle technically works? Ranorex gets the app element tree ones and then trying to find needed element in that tree for few times? Or it is trying to re-search all tree few times?

Can somebody explain all things?

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

Re: FindSingle how it really works?

Post by Support Team » Fri May 05, 2017 9:53 am

Hi i.vasilyev,
How many times will Ranorex try to re-search the button(BestClass)?
Ranorex will search trough all elements within the UI tree until the timeout is reached. Each layer is treated separately. So for example, if the form element is not found, Ranorex will search trough all top level elements for the given time period. If the form element is found, Ranorex will step one layer deeper and search for the button element, if the button element isn't found within that layer, the search algorithm will again start with searching the top level element.

I hope this information helps.

Sincerely,
Robert
.
Image

i.vasilyev
Posts: 30
Joined: Fri Sep 09, 2016 10:14 am

Re: FindSingle how it really works?

Post by i.vasilyev » Fri May 05, 2017 10:08 am

if the button element isn't found within that layer, the search algorithm will again start with searching the top level element.
Robert
So, does it mean that the all tree will be refreshed?

And what about not responding window?

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

Re: FindSingle how it really works?

Post by Support Team » Fri May 05, 2017 12:35 pm

Hi,

So, does it mean that the all tree will be refreshed?
Yes, there is no element caching.
And what about not responding window?
Well, if the AUT (application under test) is in a non-responding state, Ranorex won't be able to detect elements within the AUT, since they are simply not loaded/accessible.

Sincerely,
Robert
.
Image