Page 1 of 1

invalid Item

Posted: Mon Sep 11, 2017 3:20 pm
by andreas.tastler
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

Re: invalid Item

Posted: Tue Sep 12, 2017 8:37 am
by odklizec
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?

Re: invalid Item

Posted: Wed Sep 13, 2017 10:59 am
by andreas.tastler
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?

Re: invalid Item

Posted: Mon Sep 18, 2017 3:22 pm
by qwertzu
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

Re: invalid Item

Posted: Tue Sep 19, 2017 12:55 pm
by andreas.tastler
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