Identifying buttons on a form containing specific text

Ask general questions here.
kosmonavt
Posts: 1
Joined: Mon Jun 13, 2016 3:31 am

Identifying buttons on a form containing specific text

Post by kosmonavt » Thu Sep 22, 2016 11:59 pm

Hi,

I am sure this is possible but I can't figure it out :oops:
I have a popup that I wish to handle using the PopupWatcher class. I prefer to use the RxPath to identify and click the buttons on these popups (of which there are many!).

This works very well, as long as the form title is unique enough so that the PopupWatcher doesn't find and dismiss a prompt that we don't want it to. Well, I have come across such a prompt now where the form title is simply too generic and I'm sure that it is going to cause problems.

So, I was wondering if it is possible to identify and click on the button where there is particular caption text on the prompt. For example, consider the following two RxPaths:

Code: Select all

/form[@title='Application']/text[@caption='This is caption text']
/form[@title='Application']/button[@text='OK']
I want to be able to identify and click on the 'OK' button where there is a sibling caption text entry reading 'This is caption text'. Is it possible to do this with a single RxPath?

Thanks in advance.

krstcs
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: Identifying buttons on a form containing specific text

Post by krstcs » Fri Sep 23, 2016 1:33 pm

First, welcome to the forums!

Second, Popup Watchers should be used ONLY when you have unexpected/randomly occurring dialogs, such as network or disk warnings, etc. If you know that the dialog is going to popup then you should be coding specifically for that event in a regular module, not in a Popup Watcher.

Third, without a Ranorex Snapshot of the dialog, it's going to be impossible to give you an accurate RXPath that will work correctly and consistently.http://www.ranorex.com/support/user-gui ... files.html
Shortcuts usually aren't...