invalid Item

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
andreas.tastler
Posts: 36
Joined: Mon Sep 20, 2010 10:59 am

invalid Item

Post by andreas.tastler » Mon Sep 11, 2017 3:20 pm

Hi

I use Ranorex 7.1.2 and have the following problem.

I have a winforms application which uses devexpress menu items. When I am doing an instant tracking for the first time on the menu, everything is just fine.
Screenshot_Menu.png
Screenshot_Tracking_1.png
If I close the menu, reopen it and to a new instant tracking, the menu items in the dropdown are marked as invalid
Screenshot_Tracking_2.png
It must be a problem in the application under test, because restarting the Ranorex Spy does not solve the problem.
I also can't save a snapshot, because the invalid elements are leading to an error.
What exactly happens when an item is invalid?

Regards Andreas
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: invalid Item

Post by odklizec » Tue Sep 12, 2017 8:37 am

Hi,

Usually, this happens if the context menu (or for example combo box) is collapsed and its content is unloaded from memory. It's a normal behavior. A very good explanation, when an element becomes invalid, is here:
https://www.ranorex.com/forum/in-what-s ... tml#p44670

If you need to save the snapshot for such problematic element, the best way (to my knowledge) is doing it via recording/code module. Simply add actions leading to opening the menu in question, then add "Log Message" action with parameter Snapshot. This way you can save the snapshot without any additional mouse/keyboard interaction, which may cause disappearance of the menu. 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

andreas.tastler
Posts: 36
Joined: Mon Sep 20, 2010 10:59 am

Re: invalid Item

Post by andreas.tastler » Wed Sep 13, 2017 10:59 am

Hi,

Thank you for your answer. I read the thread you provided and I agree that the elements of the context menu are going invalid if the popup will be closed.
My problem now is, that when I reopen the menu and refresh the tree in Ranorex Spy, the elements are staying invalid. Even when I close Ranorex Spy and reopen it. I think there must something be cached, not by Ranorex Spy but maybe in UIAutomation or DevExpress components?

User avatar
qwertzu
Posts: 284
Joined: Wed Jan 25, 2017 11:08 am

Re: invalid Item

Post by qwertzu » Mon Sep 18, 2017 3:22 pm

Hi andreas.tastler,

Are the elements still invalid if you track them again after re-opening the spy?
In order to track those elements, you can do the following:
1. Click on the Track button in Ranorex Spy
2. Press and hold F12 key
2. Click on the combobox to expand it and make the MenuItems visible
3. Release the F12 key in order to track the elements.

Please let us know, if the elements are still invalid afterwards.

regards,
qwertzu

andreas.tastler
Posts: 36
Joined: Mon Sep 20, 2010 10:59 am

Re: invalid Item

Post by andreas.tastler » Tue Sep 19, 2017 12:55 pm

Hi qwertzu

Yes, the elements are still invalid after re-opening spy. Only if I re-opening the AUT they will be valid again.
I did the steps you suggested, the elements are still invalid. Now I can navigate to the elements, but this was previously possible by using the Ctrl+LWin Shortcut.
However I managed the problem. Even if the elements are invalid and the RxPath will not be displayed in Spy, the elements will be found at runtime. I entered the path manually in the items repository and the menu can be handled by the ranorex runtime!

Thank you for your help.

Regards
Andreas