Host.Local.TryFindSingle after update to Ranorx 9.x from 6.x

Best practices, code snippets for common functionality, examples, and guidelines.
matthias.scherzinger
Posts: 7
Joined: Sun Jul 14, 2019 8:34 pm

Host.Local.TryFindSingle after update to Ranorx 9.x from 6.x

Post by matthias.scherzinger » Sun Jul 14, 2019 8:39 pm

Hallo togther
I Update my RX Project from 6 to 9.
After that the mehtod Host.Local.TryFindSingle dose not work anymore.
When I use the Same RX Path in Spy i got the object in around 900ms.
With the Host.Local.TryFindSingle method I got only null

Was thair anny change in the newer Versions of Ranorex?

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

Re: Host.Local.TryFindSingle after update to Ranorx 9.x from 6.x

Post by odklizec » Mon Jul 15, 2019 8:11 am

Hi,

Please upload a Ranorex snapshot, containig the problematic element. Plus show us the xpath, you are looking for and the piece of code, which is searching for the element. Ideally, post entire solution. If you can't post your production solution, create a small sample solution, featuring problematic code, xpath and eventually 3rd party app or web page, we can look at. Thanks.
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

matthias.scherzinger
Posts: 7
Joined: Sun Jul 14, 2019 8:34 pm

Re: Host.Local.TryFindSingle after update to Ranorx 9.x from 6.x

Post by matthias.scherzinger » Mon Jul 15, 2019 6:17 pm

Hi Thx for the fast Response

some Update to my Case.

I get the Object but only if I'm not in debug mode.

The amazing thing is if I use a Repository and use the Paht of the Object with the TryFindSingle Method I get null.

If I try to use the object direct from the repository its works.

Any Idea

My Path is "/form[@controlname='MDIParent2']/?/?/form/?/?/container[@controlname='GUITransparentProxy']/container[@controltypename='DtmUserInterface']/container[@controlname='AboutBoxPresentation']"

Ranorex Version 9.1
Windows 10 Enterprise 1903
Hardware: VmWare
You do not have the required permissions to view the files attached to this post.

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

Re: Host.Local.TryFindSingle after update to Ranorx 9.x from 6.x

Post by odklizec » Mon Jul 15, 2019 6:58 pm

Hi,

As mentioned before, please upload a Ranorex snapshot (NOT screenshot) of the problematic element. Without, at very least, snapshot, it’s impossible to tell what’s wrong.
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

matthias.scherzinger
Posts: 7
Joined: Sun Jul 14, 2019 8:34 pm

Re: Host.Local.TryFindSingle after update to Ranorx 9.x from 6.x

Post by matthias.scherzinger » Tue Jul 16, 2019 9:32 am

Attached you can find the Snapshot
You do not have the required permissions to view the files attached to this post.

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

Re: Host.Local.TryFindSingle after update to Ranorx 9.x from 6.x

Post by odklizec » Tue Jul 16, 2019 9:43 am

Hi,

Looking at your code and snapshot you posted, I think the problem is that you are using too short timeout for TryFindSingle method. 2000ms is really too short timeout and may result to not found element. Have you tried to increase the timeout to 30s or longer? Ideally, try the same timeout value as is the Effective Timeout for given repository element. I'm sure that while using repository element in code, it takes longer than 2s to find the item? Just check the test progress bar or timing in report ;)

BTW, to increase the speed of element search, try to add your app (process name FMPFrame) to Ranorex whitelist. This should significantly increase the speed of search, so you may be able to use shorter timeout for TryFindSingle. Honestly, I would personally use, at very least, 30s timeout ;)
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

matthias.scherzinger
Posts: 7
Joined: Sun Jul 14, 2019 8:34 pm

Re: Host.Local.TryFindSingle after update to Ranorx 9.x from 6.x

Post by matthias.scherzinger » Tue Jul 16, 2019 2:25 pm

Hi THX for the hint

I head general issue with all item without a timeout definition.
Also the issue was that for the first element I got a technical limitation message . This limitation message takes around 8s after that the Item detection time was back to 900ms.

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

Re: Host.Local.TryFindSingle after update to Ranorx 9.x from 6.x

Post by odklizec » Tue Jul 16, 2019 2:41 pm

Hi,

So it's OK now with increased timeout?

BTW, if I were you, I would consider making the whole code simpler, by using Exists() method and mainly, using repoiteminfo element instead of hard-coding repo element directly in code. Here is what I'm often using in my tests...

Code: Select all

public static void CheckIfExists (RepoItemInfo repoElement)
{
    if (repoElement.Exists())
    {
        repoElementLBL.CreateAdapter<Ranorex.Unknown>(false).Focus();
        Report.Success("Element found");
    }
    else
    {
        Report.Failure("Element not found");
    }
}
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

matthias.scherzinger
Posts: 7
Joined: Sun Jul 14, 2019 8:34 pm

Re: Host.Local.TryFindSingle after update to Ranorx 9.x from 6.x

Post by matthias.scherzinger » Mon Jul 22, 2019 3:56 pm

Hi
I'm still fighting.

I have the Issue that I find the elements in Spy really fast but when I execute my code no element is find also with a timeout over 60s

I already have the rxsetting file in my solution.

My expectation is that my code has the same behavior then Ranorex Spy.

Any Idea what I doing wrong?
The hole test application working fine with Ranorex 6.1.

matthias.scherzinger
Posts: 7
Joined: Sun Jul 14, 2019 8:34 pm

Re: Host.Local.TryFindSingle after update to Ranorx 9.x from 6.x

Post by matthias.scherzinger » Tue Jul 23, 2019 9:46 am

Hi I Think I find a Solution ....

Temporary.

I downgrade my Windows 10 to 1809. Now everything ist working. Properly there is an issue with Ranorex 9.1 and Windows 10 1903

Vega
Posts: 222
Joined: Tue Jan 17, 2023 7:50 pm

Re: Host.Local.TryFindSingle after update to Ranorx 9.x from 6.x

Post by Vega » Tue Jul 23, 2019 9:10 pm

I already have the rxsetting file in my solution.
Have you tried making a brand new Ranorex solution and trying it? The very issue may be related to your rxsettings file. Keep in mind that there are two versions of Spy: internal and external. Internal is opened from within Ranorex Studio and external is opened from Start menu / desktop / shortcut etc.

The only difference between internal and external Spy is that they use different settings. External Spy will use the global system Ranorex settings while internal Spy will use your solution settings. Since you can find the elements in Spy but not your solution, I would guess that you are likely using external Spy which uses different settings than your solution settings Ranorex.rxsettings.

The best way to see if this is the issue, is to make a new solution (preferably in Ranorex Studio) and try to reproduce the problem.

Hope this helps

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

Re: Host.Local.TryFindSingle after update to Ranorx 9.x from 6.x

Post by odklizec » Mon Aug 05, 2019 9:41 am

Hi,

There was reported an element search slowdown related to administrator mode and Windows 10 1903
https://www.ranorex.com/forum/viewtopic ... 125#p55125
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