Live Tracking elements that disappear when lose focus

Ranorex Spy, Recorder, and Studio.
uhmdown
Posts: 54
Joined: Mon Apr 03, 2017 12:00 pm

Live Tracking elements that disappear when lose focus

Post by uhmdown » Tue May 09, 2017 12:12 pm

So, it appears that ContextMenus and Tooltips are a bit of a Catch-22 for Tracking.

If I want to track a tooltip, I need to press LeftCtrl + Windows key. But as soon as I do that, the ContextMenu/Tooltip disappears, so Ranorex Spy can't see what's inside the Tooltip (It's not a text-only tooltip).


The only way i can think of solving this catch-22 is if I could trigger the Ranorex Spy Snapshot feature with a hotkey. But from I can see, there is none.

Has anybody found a workaround to this?

User avatar
Vega
Posts: 109
Joined: Mon Jul 11, 2016 2:15 pm

Re: Live Tracking elements that disappear when lose focus

Post by Vega » Tue May 09, 2017 9:17 pm

Two approaches come to the top of my mind in this scenario. While recording, if you look at the recording dialog that says validate, pause, stop etc., click on enable hot keys. Here you will see that T is default bound to track a tooltip. It should essentially open Spy while the tooltip is on screen when you press t.

Another way to to track the tooltip: Start Tracking -> hold F12 to pause tracking (keep holding F12 down) -> perform actions needed to show the tooltip -> mouse over the tooltip -> release F12 -> Click to track

Hope this helps

uhmdown
Posts: 54
Joined: Mon Apr 03, 2017 12:00 pm

Re: Live Tracking elements that disappear when lose focus

Post by uhmdown » Wed May 10, 2017 8:16 am

Any workaround that involves mousing over the tooltip fails, because the the tooltip vanishes as soon as I try to hover my mouse over it; it isn't positioned over the element that triggers the tooltip.

So unfortunately, both workarounds you suggested fail:

The first one fails just like the Live Tracking (LeftCtrl+ WIndows key). The Tooltip element appears in the repository, but I cannot see it's children.

The second one fails because the tooltip is gone before I can hover over it.


I can, of course, find the children by writing a script that recursively prints all the children to console, but I was hoping Ranorex had thought of this scenario.

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

Re: Live Tracking elements that disappear when lose focus

Post by odklizec » Wed May 10, 2017 8:20 am

Hi,

I think a working workaround could be saving the snapshot directly from recording/code? Simply, after the appearance of tooltip, instruct Ranorex to save the snapshot of parent tooltip element (either via recording action or code). 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

uhmdown
Posts: 54
Joined: Mon Apr 03, 2017 12:00 pm

Re: Live Tracking elements that disappear when lose focus

Post by uhmdown » Wed May 10, 2017 1:47 pm

The using a Snapshot Recording Action was a great idea. But surprisingly, it didn't work either.
The tooltip element remains empty, even though it clear contains an image and some texts.

But here's something even crazier. I created a c# method that recursively printed out all children and attributes of the tooltip while the mouse was hovering over the button, so that the method would run while the tooltip was open.

It still found no children !

That leaves me really questioning my sanity; is the tooltip actually empty? It contains an image and two texts. I don't see how the tooltip can contain an image and two texts but the Tooltip element has no children.

I don't see any other element in the hierarchy that contains the image and texts that the tooltip is referring to.


I think it's time to kick this one over to Ranorex Support : /

Anyway, thanks for trying : )

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

Re: Live Tracking elements that disappear when lose focus

Post by odklizec » Wed May 10, 2017 1:57 pm

How I see it, Ranorex is simply not able to track the inner elements of that tooltip (separate image and text element). I think you are left with only two options (aside forcing the app developers to standardize the tooltip in your app :) )...
GDI capture list, which may help you to extract RAWText from the tooltip. And a second option - image-based validation. Neither option is perfect, but better than nothing ;)
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

uhmdown
Posts: 54
Joined: Mon Apr 03, 2017 12:00 pm

Re: Live Tracking elements that disappear when lose focus

Post by uhmdown » Wed May 10, 2017 2:26 pm

Yes, I'm definitely going to need to get creative here.

The App that's presenting this ninja tooltip is actually not ours. It's a platform inside which our actual SUT runs as a module. So I can't go after our devs for this. But I was loving the idea : )

User avatar
Vega
Posts: 109
Joined: Mon Jul 11, 2016 2:15 pm

Re: Live Tracking elements that disappear when lose focus

Post by Vega » Wed May 10, 2017 9:14 pm

Hmm yeah this could be annoying to test. Try this:

-Open spy
-Enter this path at the top of spy: RootPath//*[?'String']
-Replace 'RootPath' with your applications top level root
-Replace 'String' with text that will appear in the tooltip
-Perform actions to make the tooltip appear
-Search for the string in Spy by pressing enter where you previously entered the Rx path in Spy

Hopefully this works and it doesn't require you to mouse over the tool tip. It may take a while though as it is literally searching every nook and cranny of the tree to find that text, so try and pick something as unique as possible from the tooltip.

If the above doesn't work, try removing the rootpath part, this will cause it to search your entire system for the specified text.

User avatar
Stub
Posts: 173
Joined: Fri Jul 15, 2016 1:35 pm

Re: Live Tracking elements that disappear when lose focus

Post by Stub » Thu May 11, 2017 8:16 am

I'd definitely try GDI Capture via RawText items if you haven't already, that'll likely pick up text within a tooltip that isn't itself a control element.

I must admit I need to try some of these suggestions in here myself. I didn't know about the hold F12 to pause tracking for instance.

uhmdown
Posts: 54
Joined: Mon Apr 03, 2017 12:00 pm

Re: Live Tracking elements that disappear when lose focus

Post by uhmdown » Thu May 11, 2017 11:57 am

Ok, an update:

I wasn't able to get GDI to work. It just wouldn't produce the rawText data.

However, I was able to get to see the contents.

I did it by re-trying the suggestion to setup a Recording module with a Snapshot action.
It failed when I tried it at first, but the suggestion to use GDI prompted me to try the recording/snapshot-action solution again, but with a different Plugin-mode.

It didn't work when plugin was set to WpfOnly (the SUT is in WPF), but it actually worked in UIA-Only mode.
And it actually also works in WpfImproved mode (which I have been avoiding so far).

So this must be a bug in WpfOnly mode.
Actually, I just tried to do a normal Live Tracking with Ranorex Spy in WpfPreferredMode while the ToolTip is visible, and Ranorex Spy simply freezes (no tooltip, no freeze). So there's definitely some kind of buggy behaviour in there with regards to Wpf Tooltips.

(And this probably also means I should consider converting my Xpaths to WpfImproved)

User avatar
Vega
Posts: 109
Joined: Mon Jul 11, 2016 2:15 pm

Re: Live Tracking elements that disappear when lose focus

Post by Vega » Thu May 11, 2017 9:39 pm

Thanks for the update. I would highly recommend using WpfImproved from experience, the difference for me was huge. The only reason not to use it is if you already have a massive repository full of WPF objects which were tracked using a different plugin as this will break your existing paths until you update them.

uhmdown
Posts: 54
Joined: Mon Apr 03, 2017 12:00 pm

Re: Live Tracking elements that disappear when lose focus

Post by uhmdown » Mon May 15, 2017 9:59 am

I just tried to convert part of our repositories;
I really wanted to like it. It was producing some really compact (but weird) xpaths.
In the end, I actually disliked it lot : (

Its so indiscriminate in removing containers, that even the convenient ones are taken out, and that actually causes problems with containers that can expand and collapse. And I feel like I've barely scratched the surface.

Ugh, I'm not prepared to expose our entire set of repositories to the uncertainty of WpfImproved mode.
I really hope Ranorex doesn't just abandon the normal WpfOnly mode.

Anyways, thanks for the suggest.

User avatar
Vega
Posts: 109
Joined: Mon Jul 11, 2016 2:15 pm

Re: Live Tracking elements that disappear when lose focus

Post by Vega » Mon May 15, 2017 10:26 pm

Are you still having issues with the tooltip? If so, is it possible for you to post a snapshot of the tooltip that is giving you trouble?

uhmdown
Posts: 54
Joined: Mon Apr 03, 2017 12:00 pm

Re: Live Tracking elements that disappear when lose focus

Post by uhmdown » Tue May 16, 2017 8:50 am

I had a Session with Ranorex Support yesterday, and they revealed there was a setting that made the tooltip contents appear.
It was the "Show All Elements" plugin setting; enabling it revealed the contents. But this disabled all compacting, so the resulting xpaths became utterly, ridiculously long (hence only useful for analysis).

I also learned alot about the way the plugins work. The core technology of WpfOnly and WpfImprovedOnly are the one and same (in fact they all are). They are just two different presets for a large complex set of parameters that their object recognition can be configured with.

So its not because the tooltip contents aren't detectable; its because the WpfOnly config is doing some excessive compacting of the xpath in this particular scenario.

To fix this, they will either tweak the WpfOnly preset, or create one that specifically addresses our situation.
Last edited by uhmdown on Tue May 16, 2017 12:05 pm, edited 2 times in total.

User avatar
Stub
Posts: 173
Joined: Fri Jul 15, 2016 1:35 pm

Re: Live Tracking elements that disappear when lose focus

Post by Stub » Tue May 16, 2017 8:59 am

Excellent follow-up, uhmdown. Thanks.