Problem with closing tested application.

Ask general questions here.
Krzysztof Zajac
Posts: 6
Joined: Wed Apr 19, 2017 2:39 pm

Problem with closing tested application.

Post by Krzysztof Zajac » Wed Apr 19, 2017 2:53 pm

I'm testing the c# WPF application. After recording the actions the last one is to close the application.
Doing this I'm clicking the X button. The action is recorded correctly. But then when I want to run the test the Ranorex is not closing my application. Also instead of clicking the button I used new action - Close Application. And is this case I got from Ranorex info Access is denied.
Another problem is that all action is going very slowly.

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

Re: Problem with closing tested application.

Post by odklizec » Thu Apr 20, 2017 1:00 pm

Hi,

Unfortunately, without knowing more about your app under test and Ranorex version, there is not much anyone here can suggest.

Please post a Ranorex snapshot (not screenshot!) of the problematic element (x button).
Please show us xpath for the [x] button, as recorded in repo.

As for playback speed (slowness), it's hard to suggest something without knowing which actions are slow, recorded xpaths and ideally, working sample AUT and sample test suite.
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

Krzysztof Zajac
Posts: 6
Joined: Wed Apr 19, 2017 2:39 pm

Re: Problem with closing tested application.

Post by Krzysztof Zajac » Thu Apr 20, 2017 1:12 pm

The version of the Ranorex is 7.0.0
Path to the [x] button is:

Code: Select all

/form[@title~'^DAE\ Configuration\ Utility']/container[2]/?/?/button[@automationid='PART_Close']
Also instead of this I used the Close Application action where the path into the closing application is:

Code: Select all

/form[@title~'^DAE\ Configuration\ Utility']/grip[@automationid='PART_WindowTitleThumb']
And as I said before when the test is completed the tested application is still opened on the task bar.
And when the Close Application action is done the Ranorex log shows message:
"Access is denied".
I have to add that when I'm only the Close Application action as Run Selected Item the Ranorex is closing my application correctly. But cannot to close the application when full test is invoked.
Regarding the slow speed here is the path into the object I want to click:

Code: Select all

/form[@title~'^DAE\ Configuration\ Utility']/list[@automationid='Dock']/?/?/tabpage[@title='Configuration Explorer']/?/?/treeitem[@text='Housekeeping']/container[@automationid='ItemsHost']/treeitem[@text='OPs']/container[@automationid='HeaderContentPanel']/text[@caption='OPs']
But what is interesting I can press shift + pause and the object is founding immediately.

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

Re: Problem with closing tested application.

Post by odklizec » Thu Apr 20, 2017 1:52 pm

Hi,

Please post also the AUT's snapshot, so we can analyze the provided xpaths. As for the "Access is denied" error, are you sure both test and AUT are started with the same privileges?
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

Krzysztof Zajac
Posts: 6
Joined: Wed Apr 19, 2017 2:39 pm

Re: Problem with closing tested application.

Post by Krzysztof Zajac » Thu Apr 20, 2017 2:18 pm

Attached the snapshot. Hope it will be useful.
Regarding the privileges. I'm running the test under the Ranorex GUI that I run as an administrator. I don't know what privileges I should set additionally.
When I run this from the exe file the result is still the same.
You do not have the required permissions to view the files attached to this post.

Krzysztof Zajac
Posts: 6
Joined: Wed Apr 19, 2017 2:39 pm

Re: Problem with closing tested application.

Post by Krzysztof Zajac » Thu Apr 20, 2017 2:32 pm

And here I attached snapshot only for the [x] button.
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: Problem with closing tested application.

Post by odklizec » Thu Apr 20, 2017 2:37 pm

Hi,

Thanks for the snapshot. As for "close" button, there seems to be no such path as provided in your previous post. Apparently, there is no container[2]. But then there should be issued an "element not found" error?

Anyway, I would suggest to use this path instead:

Code: Select all

/form[@title~'^DAE\ Configuration\ Utility']/container//button[@automationid='PART_Close']
As for the slow speed, I would suggest to eliminate '?' characters from the xpath, which can slow the speed of search. You see, there seems to be two "OPs" texts in your app and if there are used question marks in the xpath, Ranorex tries to search entire GUI tree. And this is probably why Shift+Pause quickly finds an element, because basically, it skips the search of entire GUI tree and simply selects the first one found. I guess the search will be noticeably faster after removing those questions marks? ;)

Also, I would suggest to eliminate certain parts of the xpath. Try this xpath instead...

Code: Select all

/form[@title~'^DAE\ Configuration\ Utility']/list[@automationid='Dock']//treeitem[@text='Housekeeping']/container[@automationid='ItemsHost']/treeitem/container[@automationid='HeaderContentPanel']/text[@caption='OPs']
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

Krzysztof Zajac
Posts: 6
Joined: Wed Apr 19, 2017 2:39 pm

Re: Problem with closing tested application.

Post by Krzysztof Zajac » Thu Apr 20, 2017 2:57 pm

Thanks a lot for your response.
1.OK, now the Ranorex is closing my application, but what is still strange is that I had to manually improve the path first asking you about help. Why the path was not recorded by the Ranoerx correctly?
2.Speed. Now is better means faster, but still I have the same question like above.
3.Still I don't know why I got the Access denied for Close Application action.

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

Re: Problem with closing tested application.

Post by odklizec » Thu Apr 20, 2017 3:24 pm

As for 1) my guess is that there were opened multiple instances of the application in the background, so Ranorex identified the container of active one as [1] or [2]?

As for 2) I don't have a clue? Ranorex 7 changed the way of identification of WPF elements, so maybe there is a bug? Anyway, I would suggest to evaluate each recorded xpath and eventually, optimize it. Recorder is a nice help, but many recorded xpaths could be always optimized ;) Eventually, you can alter the way Ranorex generates xpaths, by selecting different xpath generation mode or by modifying xpath weight.

As for 3) I'm afraid, I don't have a clue here. Maybe it has something to do with 1st problem (i.e. multiple opened instances of AUT)?
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

Krzysztof Zajac
Posts: 6
Joined: Wed Apr 19, 2017 2:39 pm

Re: Problem with closing tested application.

Post by Krzysztof Zajac » Thu Apr 20, 2017 3:43 pm

Hi Pavel,

Thanks a lot for your help. It was really useful.

kz