Teardown

Best practices, code snippets for common functionality, examples, and guidelines.
yaro2o
Posts: 51
Joined: Mon Jan 29, 2018 11:19 am

Teardown

Post by yaro2o » Tue Feb 20, 2018 1:19 pm

Hi, I have a problem. I have about 12 dialog boxes in each button close, in each window is called identically, but the windows have different names and look different in the repository, is the option to click this button with no difference in which window is located?

Maybe if (buttonzamknij.visible) do something ?

I will add that it is about returning to the state 0 for the next TC if the previous error pops up and the windows remain open, and does not want to run the program again from time to time

what is the best option to restore the program to state 0, bypassing the restart ?

Edit Support Team 2018-02-21: Merged posts
Attachments
Wm_2018-02-20_13-18-08.png
Wm_2018-02-20_13-18-08.png (19.75 KiB) Viewed 729 times

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

Re: Teardown

Post by odklizec » Tue Feb 20, 2018 1:40 pm

Hi,

Please upload at least two Ranorex snapshots, in which we can see and evaluate the xpaths. Please post also the xpath for [x] button, as you have it recorded in repo. Thanks.
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

yaro2o
Posts: 51
Joined: Mon Jan 29, 2018 11:19 am

Re: Teardown

Post by yaro2o » Tue Feb 20, 2018 2:08 pm

Here is snap
Dialog.rxsnp
(33.99 KiB) Downloaded 14 times
And here is xpath
RanorexStudio_2018-02-20_14-04-21.png
RanorexStudio_2018-02-20_14-04-21.png (26.02 KiB) Viewed 643 times
as you can see the dialogue is called frxDialogForm4 in another it will be DialogForm5 but the ending is the same

Edit Support Team 2018-02-21: Merged posts

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

Re: Teardown

Post by odklizec » Tue Feb 20, 2018 2:24 pm

Hi,

OK, the problem is in the controlname attribute, which probably changes for each popup dialog? I would suggest to use xpath like this:

Code: Select all

/form[@controlname~'frxDialogForm' and @windowextendedstyle~'DialogModalFrame' ]/?/?/button[@accessiblename='Zamknij']
The additional attribute @windowextendedstyle~'DialogModalFrame' means, that the dialog is modal. It may help with identifying "modal" popups. But you need to test it with your AUT and other popups.
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

yaro2o
Posts: 51
Joined: Mon Jan 29, 2018 11:19 am

Re: Teardown

Post by yaro2o » Tue Feb 20, 2018 2:30 pm

for each window I set the same or will the beginning be different for each window and only the second part of the modal common?

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

Re: Teardown

Post by odklizec » Tue Feb 20, 2018 2:43 pm

The xpath I provided should work with all popups, as long as their controlname contains "frxDialogForm" and windowextendedstyle atributte contains "DialogModalFrame". And of course, there must be available button[@accessiblename='Zamknij'].
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

yaro2o
Posts: 51
Joined: Mon Jan 29, 2018 11:19 am

Re: Teardown

Post by yaro2o » Tue Feb 20, 2018 2:57 pm

K thx i will test it tomorrow :)

Hello, unfortunately it probably does not work as it should or do something wrong, as I change the path to the above given, ranorex does not detect the window and how would I set all tfrxDialogForm class for all, because all of them have the same class parameter, and later wrote a code that would close all windows having this parameter selected?

Edit Support Team 2018-02-21: Merged posts

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

Re: Teardown

Post by odklizec » Wed Feb 21, 2018 2:55 pm

Hi,

Well, have you checked the xpath of failed window? Unfortunately, it's impossible for me (or anyone else here) to suggest what's wrong, without access to the AUT or at very least, the snapshot of failing dialog.
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

yaro2o
Posts: 51
Joined: Mon Jan 29, 2018 11:19 am

Re: Teardown

Post by yaro2o » Wed Feb 21, 2018 3:10 pm

HI, if I set cotrolname = ~ Regex Match its look work fine i write while loop

Code: Select all

while (repo.Test.Test.SelfInfo.Exists())
            {
        		repo.Test.Test.Self.Close();
            }

and this code close all window, but i heave another problem.

I heave 2 window FRM1 and FRM2 but on top is another window DLGDataSet to choose something how in code close all window FRM and DLG
Wm_2018-02-21_15-08-34.png
Wm_2018-02-21_15-08-34.png (152.52 KiB) Viewed 658 times
Snap
Dialog3.rxsnp
(37.82 KiB) Downloaded 8 times
Edit Support Team 2018-02-21: Merged posts

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

Re: Teardown

Post by odklizec » Wed Feb 21, 2018 3:24 pm

Well, apparently this dialog has different control name and different windowsextendedstyle. So in case you wish to create a 'universal' repo item, you need to extend the xpath with some more options. This xpath should find close button in both presented forms (modal and non-modal)...
/form[@controlname='DlgDataSetList' or (@controlname~'frxDialogForm' and @windowextendedstyle~'DialogModalFrame')]/?/?/button[@accessiblename='Zamknij']
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

yaro2o
Posts: 51
Joined: Mon Jan 29, 2018 11:19 am

Re: Teardown

Post by yaro2o » Wed Feb 21, 2018 3:35 pm

maybe something like this illuminates 3 windows?

Code: Select all

/form[@processname='Wm' and @controlname~'frxDialogForm' or @controlname~'Dlg']

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

Re: Teardown

Post by odklizec » Wed Feb 21, 2018 3:38 pm

Possibly, but it's up to you to test it with your 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

yaro2o
Posts: 51
Joined: Mon Jan 29, 2018 11:19 am

Re: Teardown

Post by yaro2o » Wed Feb 21, 2018 3:56 pm

K it works fine thx :)

yaro2o
Posts: 51
Joined: Mon Jan 29, 2018 11:19 am

Re: Teardown

Post by yaro2o » Thu Feb 22, 2018 10:00 am

K that I tested works great, but I would like to add another window there, send a snap, some ideas ?
Attachments
dial2.rxsnp
(247.19 KiB) Downloaded 8 times

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

Re: Teardown

Post by odklizec » Thu Feb 22, 2018 10:17 am

Hi,

I'm afraid, I'm not sure what exactly you want to do with this form? If it's still about 'Zamknij' buttons, then there is multiple of them in the snapshots, so you need to decide, which one you want to control and simply use the same approach as before. Simply add new control name to xpath.
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