How to Customize a PopUpWatcher?

Class library usage, coding and language questions.
generalecaster
Posts: 20
Joined: Thu May 09, 2013 10:44 am

How to Customize a PopUpWatcher?

Post by generalecaster » Thu Aug 08, 2013 3:38 pm

Hi all,
I need to customize a PopUpWatcher.
I've alredy used it to close popups by pressing OK button.
Now I have to do a different thing.
I need to execute a customized method when a specified popup appares.
Is there a way to do it?

For example I need to convert this:

Code: Select all

myPopupWatcher.WatchAndClick(repo.UpdateCheckDialog, repo.UpdateCheckDialog.btCloseInfo);
in this:

Code: Select all

myPopupWatcher.Watch(repo.UpdateCheckDialog, myCustomizedMethod);
Thanx
Max

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: How to Customize a PopUpWatcher?

Post by Support Team » Fri Aug 09, 2013 3:26 pm

Hello,

Unfortunately, the PopupWatcher does not provide a method to pass two elements to a custom method.
Would it be an option for you to watch on the 'Close' button and call your custom method?

Code: Select all

myPopupWatcher.Watch(repo.UpdateCheckDialog.btCloseInfo, myCustomizedMethod);
Regards,
Markus (T)

generalecaster
Posts: 20
Joined: Thu May 09, 2013 10:44 am

Re: How to Customize a PopUpWatcher?

Post by generalecaster » Tue Nov 26, 2013 11:11 am

Hi Markus,

first of all, I wanna thank you for support, then I have an other question: may I select the popup where PopupWatcher will work on?
I know my english isn't very clear, so I try to make an example: I have 2 kind of popup that can appare in a web page. The first popup got a "Text one" as text, while the second one got "Text two". Can I tell to PopupWatcher that it must work just on the popup having "Text one"?

Thanx again
Max

Swisside
Posts: 92
Joined: Thu Oct 10, 2013 10:40 am

Re: How to Customize a PopUpWatcher?

Post by Swisside » Tue Nov 26, 2013 2:18 pm

Hello

Can you access those attributes (Text one and text two) with Spy ?

If so just define the repository item to only target the popup with text one.


Example (In Spy) :

mypopup => Form[@title='Text One']


Regards
A simple thank you always does wonders !

generalecaster
Posts: 20
Joined: Thu May 09, 2013 10:44 am

Re: How to Customize a PopUpWatcher?

Post by generalecaster » Tue Nov 26, 2013 3:39 pm

Hi Swisside,

meanwhile, trying some solutions, I've found one like yours.
I've tracked this:

Code: Select all

/form[@title~'Popup Title']/text[@text='Text One']/..
... and it works! :D

Thanx a lot
Max