Page 1 of 1
Ranorex search infinitly long for hidden Winform
Posted: Wed Sep 19, 2018 7:56 am
by ChrisN.
I use an application in PTC-Creo which open an SAP window, when I choose a file in this and open it or I go back with (back) button, then the SAP window goes in background but still open, because the connection must be stay. Ranorex search for this winform but can't find . This SAP window in backround can't be seen, can only reopened with the same button, with wich I started it , but Rorex freeze already and I must do it self, before the waittime is up. After I Close this Winform full, I get a Winform Warning.
Windows 7
Ranorex Version 8.2.1
Re: Ranorex search infinitly long for hidden Winform
Posted: Wed Sep 19, 2018 8:11 am
by odklizec
Hi,
May I ask, what exactly do you want to do with the hidden window? Because this does not sound like a typical use case for UI automation?
Are you sure the xpath for the element you are searching for is correct (after the window goes hidden)? Any chance you can share both xpath and snapshot of the problematic element? Ideally, post also the exact step (screenshot of your recording or copy of user code), during which Ranorex fails to find the element. And finally, have you tried it on another computer? I'm afraid, Win 7 is already outdated and no longer supported even by MS.
Re: Ranorex search infinitly long for hidden Winform
Posted: Wed Sep 19, 2018 9:08 am
by ChrisN.
Hi, thanks for answer.
The window which goes in backgrund is a SAP GUI, which oppened from another application, this hold a connection to the SAP file server. I don't want do enything with it if its in background, I just want that ranorex dont try to search for it, if its in background, because its begin to freeze. I can't make a record or run a script because ranorex freeze after the window is hidden. Search for Xpath don't works, nothing in ranorex works if this window is hidden.
This is the easiest script which i can make. The Strings are not full in the Picture because to long for pic and I don't try it on any other PC.
Re: Ranorex search infinitly long for hidden Winform
Posted: Wed Sep 19, 2018 9:31 am
by odklizec
Hi,
It would be useful, if you could post the code as text (instead of screenshot) and also please post the AUT snapshot (mainly the window in background).
Ranorex only searches for an element, if the element is accessed from test (either recording or user code). So my guess is, that one of the lines in your code actually points to that window in background? Ideally, take the snapshot of problematic window BEFORE and AFTER it goes to background. Thanks.
BTW, is there a reason why you are accessing UI elements via hardcoded xpaths, instead of using repository elements as method parameters (either RepoItemInfo or Adapter)? Your approach makes the code hard to read and maintain and it's an easy way to errors.
Re: Ranorex search infinitly long for hidden Winform
Posted: Wed Sep 19, 2018 1:11 pm
by ChrisN.
Hi, I changed the strings to repo path. I added the solution in to zip file and loaded it to dropbox with Snapshot befor it crash. This solution works only one time if I repeat it i get problems with freeze by Ranorex. Unfortunality I can't make a snapshot after the crash, because i get a error of invalide object. I maked a screenshot.
Here is the link to the dropbox.
Thanks for your help
https://www.dropbox.com/sh/emnd8sm55x9h ... Effra?dl=0
Screenshot of Invalid element
Re: Ranorex search infinitly long for hidden Winform
Posted: Wed Sep 19, 2018 1:27 pm
by odklizec
Hi,
If I understand it right, the problem happens after clicking "back" button, which somehow redraws the content of "CreoParametric" form? And after that, any attempt to access the elements in CreoParametric form fails, right? Have you tried to disable "
Use Cache" parameter for CreoParametric form?
DisableCache.png
Re: Ranorex search infinitly long for hidden Winform
Posted: Wed Sep 19, 2018 3:45 pm
by ChrisN.
Hi, for this TEST it woks one time. If I execute it again, I get a same Problem like bevor. In my main Program I get trought this Option other Problems like a search for a path, which ranorex cant find then. But it was a nice tipp, thanks.
I have contacted a Ranorex support, hope he can help me.
Thank you very much for you help
Re: Ranorex search infinitly long for hidden Winform
Posted: Mon Oct 01, 2018 9:21 am
by ChrisN.
Hi, I can now exactly say what the Problem is. After I select my SAP file or go back, my SAP window goes in the background and don't react for any actions. I can open it and set it in the foreground but i can't do anything with it, its like a pic. Ranorex try to track this winform but can't do it, so my execute cant finish, because ranorex hang in a while tracking loop. What can I do so that ranorex don't try to track this winform when I closed it?
Re: Ranorex search infinitly long for hidden Winform
Posted: Mon Oct 01, 2018 9:28 am
by odklizec
Hi,
The solution should be quite simple. You just should not access any element on this window after the window is set to background
My guess is, that after the window is 'backgrounded', you still trying to access any element on it from your recordings/code modules? And this is what's causing the infinite search, although I don't understand, why the search is not terminated after reaching the Effective Timeout? Unfortunately, without seeing your solution and AUT, it's pretty hard to suggest something meaningful.
Re: Ranorex search infinitly long for hidden Winform
Posted: Mon Oct 01, 2018 11:15 am
by ChrisN.
Hi, thank your for help. There are no actions in this window after it is minimized, that's the problem. Spy-function freezing too, if I try to track or refresh but this is explainable.
Re: Ranorex search infinitly long for hidden Winform
Posted: Mon Oct 01, 2018 11:52 am
by odklizec
I'm sorry I could not help you more. I think your best hope is to create a support ticket and request remote session with Ranorex folks. They may be able to help you with this issue by suggesting something obvious, which I unfortunately don't see (without examining the problematic app and your solution).
Re: Ranorex search infinitly long for hidden Winform
Posted: Mon Oct 01, 2018 12:02 pm
by ChrisN.
Problem is solved, Ranorex tryed to track a SAP window in the background and freezed by this. Solution was to disabeling the SAP Plugin in this time, when the window was in background and not used and must be enabled befor SAP window using again.
"Ranorex.Plugin.SapFlavor.Instance.Enabled = false/true;"