How to deal with large amount of unrecognized elements?

Ask general questions here.
dugovic.milan
Posts: 68
Joined: Wed Jun 29, 2016 1:19 pm
Location: Frankfurt, Germany
Contact:

How to deal with large amount of unrecognized elements?

Post by dugovic.milan » Mon Jan 30, 2017 2:27 pm

Hi everyone. As you can see from the screenshot, these child element are not being correctly recognized by Ranorex, and that even when I switch to "simple" XPath generation mode. The only way how to identify desired element is via Index, which changes randomly (lol). Is there any way how to exactly define desired element other than using Index?
You do not have the required permissions to view the files attached to this post.
Last edited by dugovic.milan on Mon Feb 06, 2017 9:20 am, edited 2 times in total.
Ranorex Explorer @DVAG
Support my Ranorex Ideas & Improvements
My current approach: Ranorex 9.2.0

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

Re: How do you deal with large amount of not-recognized element?

Post by odklizec » Mon Jan 30, 2017 2:37 pm

Hi,

You see, without at least snapshot, there is not much we can do or suggest ;) If you are sure there is no other usable attribute, it may still be possible to find an element by referencing another element (e.g. label). So please post a Ranorex snapshot, or send it privately to Ranorex support (eventually, request a remote session with them). There is really nothing we can suggest just from looking at screenshot ;)
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

Shakib
Posts: 32
Joined: Tue Jan 06, 2015 7:22 am

Re: How do you deal with large amount of not-recognized element?

Post by Shakib » Wed Feb 01, 2017 12:04 pm

Hi milan,

May be these controls will get path on run time.
Some time it happen with any type of controls so a good approach is:

1. Track parent control and keep the X-path as it is no change.
2. Write a code which will read children in run time:

foreach(var currentChild in trackedParentControl.FIndDescendent<Button>)())
{
Report.Info(currentChild.GetPath());
}

Some time it is requried to read x-path or any control on run time, it can save your time as well.
Please let me know if you find any difficulties.

Fergal
Certified Professional
Certified Professional
Posts: 455
Joined: Tue Feb 18, 2014 2:14 pm
Location: Co Louth, Ireland
Contact:

Re: How do you deal with large amount of not-recognized element?

Post by Fergal » Wed Feb 01, 2017 4:21 pm

foreach(var currentChild in trackedParentControl.FIndDescendent<Button>)())
{
Report.Info(currentChild.GetPath());
}
Shakib when I tried a version of your code Ranorex gave the error message below:
foreach statement cannot operate on variables of type 'Ranorex.Button' because 'Ranorex.Button' does not contain a public definition for 'GetEnumerator' ...
Is there a way round that?

Thanks.

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

Re: How do you deal with large amount of not-recognized element?

Post by odklizec » Thu Feb 02, 2017 8:23 am

Hi Fergal,

I think you need to use FindDescendants, which returns list of descendants, instead of FindDescendant, which returns just one item. Hope this helps?
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

Fergal
Certified Professional
Certified Professional
Posts: 455
Joined: Tue Feb 18, 2014 2:14 pm
Location: Co Louth, Ireland
Contact:

Re: How do you deal with large amount of unrecognized elements?

Post by Fergal » Fri Feb 03, 2017 12:08 pm

Hi odklizec, thanks very much for that, it works perfectly.

One other small think I needed to add was a ToString in the report item, as in:

Report.Info(currentChild.GetPath().ToString());