How to speed up the lookup for a ui element?

Ask general questions here.
hghesani
Posts: 4
Joined: Mon May 21, 2018 7:55 pm

How to speed up the lookup for a ui element?

Post by hghesani » Mon May 21, 2018 8:05 pm

Hi

I am interested in learning how I can use ranrorex so that lookup for an element is quicker than it currently is. Essentially, I would like to know if the element with a certain charecteristic exists or not :

For eg, I am looking for an element with unknown row index and known text, and the code tries look for this item by looking if the item exists with different values of row id.
within for loop, search till you find:
{
RepoItem = ..?/?/row[@index=$rownumber]/cell[@text="<known text string>"];
if(RepoItem.Exists)
{
break;
}
}

I cannot use just the text string to identify that element, since there are multiple entries in the same table and I need to search for that cell within certain range of indices to find it. RepoItem.Exists, takes some time to confirm if the element exists or not, how can I shorten this time.

Please let me know

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

Re: How to speed up the lookup for a ui element?

Post by odklizec » Tue May 22, 2018 7:19 am

Hi,

Unfortunately, without seeing your app or at very least Ranorex snapshot (NOT screenshot) of the problematic table, there is not much anyone here can do or suggest. Any chance you can provide us with either working sample or snapshot?
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

hghesani
Posts: 4
Joined: Mon May 21, 2018 7:55 pm

Re: How to speed up the lookup for a ui element?

Post by hghesani » Tue May 22, 2018 6:42 pm

odklizec wrote:Hi,

Unfortunately, without seeing your app or at very least Ranorex snapshot (NOT screenshot) of the problematic table, there is not much anyone here can do or suggest. Any chance you can provide us with either working sample or snapshot?
Hi

Its a table with various elements coded using mfc. The absolute of the element being looked for would be

/form[@title='<knowntitle>' and @processname='<knownprocessname>'' and @class='<knownstring>']/?/?/row[@index='<unknownindex>']/cell[@text>'<known text name>']


If know the row index I can find this. This is the xpath I need to use to confirm if the element exists or not. It takes a long time to confirm that the element does not exist , if the index provided is not the correct one. I am trying to look for the element, with various values of @index so that i can find the right walue of @index, for which this element exists.

Would this help ?

Thanks,

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

Re: How to speed up the lookup for a ui element?

Post by odklizec » Thu May 24, 2018 8:10 am

Hi,

There is no way to speed-up the lookup for an element. I mean, the speed of search depends on the quality of xpath. If the xpath is unique enough, the speed of search should be relative quick. However, if the element does not exists, Ranorex tries to search for the element its entire Effective Timeout, which is a sum of all Search Timeouts of all parents above the actual element. The only way how to "speedup" Exists method is to add a timeout parameter, like this...

Code: Select all

...
if(RepoItem.Exists(30000))
...
But remember that too short timeout could return incorrect result, because if the timeout is too short, Ranorex may not find an existing 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

hghesani
Posts: 4
Joined: Mon May 21, 2018 7:55 pm

Re: How to speed up the lookup for a ui element?

Post by hghesani » Fri Jun 01, 2018 8:12 pm

Thanks, that certainly helps !!! Additional question, how does caching a ui element affect this ? Is there a way to enable/disable caching when code is executed or within a code module.

Thanks,

odklizec wrote:Hi,

There is no way to speed-up the lookup for an element. I mean, the speed of search depends on the quality of xpath. If the xpath is unique enough, the speed of search should be relative quick. However, if the element does not exists, Ranorex tries to search for the element its entire Effective Timeout, which is a sum of all Search Timeouts of all parents above the actual element. The only way how to "speedup" Exists method is to add a timeout parameter, like this...

Code: Select all

...
if(RepoItem.Exists(30000))
...
But remember that too short timeout could return incorrect result, because if the timeout is too short, Ranorex may not find an existing element ;)

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

Re: How to speed up the lookup for a ui element?

Post by odklizec » Mon Jun 04, 2018 8:05 am

Hi,

I'm not quite sure, if there is a way to globally disable cache for all (already generated) repo elements? I think you will have to do it element by element. The code to disable cache looks like this:

Code: Select all

repo.FolderName.UseCache=false;
Enabled cache should improve the speed of search for element. So if you disable it, it may slow the search ;)
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

ethanscott
Posts: 1
Joined: Mon Jun 04, 2018 2:18 pm

Re: How to speed up the lookup for a ui element?

Post by ethanscott » Tue Jun 05, 2018 7:50 am

odklizec wrote:Hi,

I'm not quite sure, if there is a way to globally disable cache for all (already generated) repo elements? I think you will have to do it element by element. The code to disable cache looks like this:

Code: Select all

repo.FolderName.UseCache=false;
Enabled cache should improve the speed of search for element. So if you disable it, it may slow the search ;)
Will this involve the cache memory of the system or create a false cache using the permanent memory?
If there were no humor, life would be tragic.

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

Re: How to speed up the lookup for a ui element?

Post by odklizec » Tue Jun 05, 2018 8:21 am

Hi,

To be honest, I don't have a clue? I guess it simply stops caching elements under pointed repo folder and every time the folder is accessed, Ranorex refreshes its content.
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