Reuse of Button functionality

Ask general questions here.
rwn60
Posts: 10
Joined: Thu May 31, 2018 6:08 pm

Reuse of Button functionality

Post by rwn60 » Tue Aug 14, 2018 5:50 pm

Hello,
I've attached a repository snippet for better understanding:
1) I'm attempting to create a user folder that contains a variable that can be reused on several windows that do a "Save".
2) I've highlighted the 3 different times I selected the "Save" button in my GUI.
3) How can I make a user created folder that would incorporate the three instances of "Save".
4) Earlier in my troubleshooting I created a user folder called "CancelButtonParent" and I have a "Cancel" variable so I tried to do the same for "Save", but I noticed my three "Save" buttons had a parent with a different title name. So, it couldn't work like the "Cancel" concept.

All help greatly appreciated
You do not have the required permissions to view the files attached to this post.

User avatar
N612
Posts: 135
Joined: Mon Jul 11, 2016 4:01 pm

Re: Reuse of Button functionality

Post by N612 » Tue Aug 14, 2018 9:27 pm

Why not just make one repository item that works for all three buttons by using the > (starts with) instead of = (equal) for the name attribute? The below should work as long as none of these three buttons exists at the same time.
container[@type='BorderPane']/?/?/button[@name>'save']

rwn60
Posts: 10
Joined: Thu May 31, 2018 6:08 pm

Re: Reuse of Button functionality

Post by rwn60 » Wed Aug 15, 2018 6:13 pm

Thanks, I'll give it a try!

rwn60
Posts: 10
Joined: Thu May 31, 2018 6:08 pm

Re: Reuse of Button functionality

Post by rwn60 » Wed Aug 15, 2018 6:55 pm

N612,
1) I tried your suggestion, but now Ranorex is going to the wrong spot. Then it gives a successful run, but with warnings because mouse click does not take place (reason being, it's going to the wrong location: "The mouse action was performed outside the boundaries of the assigned UI element").
2) Also tried changing the "Action spot" values in the "File View" location, but that did not work either.

Any other suggestions?

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

Re: Reuse of Button functionality

Post by odklizec » Wed Aug 15, 2018 8:12 pm

Hi, my guess is that the xpath now returns multiple “save” buttons available in the app, including hidden ones. Try to add this at the end of xpath...
and @visible=‘true’
So the whole xpath should look like this...
container[@type='BorderPane']/?/?/button[@name>'save' and @visible=‘true’]
Anyway, it would be much easier to suggest correct xpath, if you post a Ranorex snapshot (Not screenshot) of the app under test. Ranorex snapshot would help us to understand the GUI structure of tested app.
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

rwn60
Posts: 10
Joined: Thu May 31, 2018 6:08 pm

Re: Reuse of Button functionality

Post by rwn60 » Wed Aug 15, 2018 8:49 pm

Thanks odklizec....I'm new to Ranorex so first I'll try your suggestion and then I'll work on the Ranorex snapshot creation...thanks again!

rwn60
Posts: 10
Joined: Thu May 31, 2018 6:08 pm

Re: Reuse of Button functionality

Post by rwn60 » Mon Aug 20, 2018 9:50 pm

Hello odklizec,
Your last post requested that I make a Ranorex snapshot(s), which I did, but because I work on a classified system I'm not able to send them. Our SAs stated that because they are binary files they would not be able to port them over to the unclassified side for sending. So:

a) /form[@provessname='java']/container[@type='BorderPane']/?/?/button[@name='cancel' and @visible='true']
b) /form[@provessname='java']/?/?/button[@name='cancel']

In "a" this will work for some of the panes, but I have some gui windows with the "b" xpath. Is there anyway to create a user item which would catch all the "cancel" buttons no mater what window(various different xpaths) they are on?

Thanks...

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

Re: Reuse of Button functionality

Post by odklizec » Tue Aug 21, 2018 7:27 am

Hi,

I'm sure this xpath should work fine for both kinds of Cancel button in your GUI...
/form[@processname='java']//button[@name='cancel' and @visible='true']
The thing is, that if there are more apps started with java process, it may search for "cancel" button in all of them! So I would suggest to improve the xpath of initial "form".
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

rwn60
Posts: 10
Joined: Thu May 31, 2018 6:08 pm

Re: Reuse of Button functionality

Post by rwn60 » Tue Aug 21, 2018 2:12 pm

Thanks odklizec!