Popup Watcher problem

Ask general questions here.
elis
Posts: 15
Joined: Sun Nov 10, 2013 10:27 am

Popup Watcher problem

Post by elis » Wed Dec 11, 2013 1:23 pm

Hi,

I just configured a popup watcher for my action and it doesn't work.
Can you please have a look on the code below and tell me what is wrong in my config?
The popup watcher is configured as "user code" ( ClosePopupWindows() ).

public void ClosePopupWindows()
{
PopupWatcher myPopupWatcher = new PopupWatcher();
myPopupWatcher.Watch("/form[@class='SunAwtDialog']", CloseUpdateCheckDialog);

}


public static void CloseUpdateCheckDialog(Ranorex.Core.RxPath myPath, Ranorex.Core.Element myElement) {
Keyboard.Press("{Tab}");
Keyboard.Press("{Tab}");
Keyboard.Press("{Space}");
Keyboard.Press("{Return}");
}


Thanks :)

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

Re: Popup Watcher problem

Post by Swisside » Wed Dec 11, 2013 1:41 pm

Hi !

If you check the tutorial from the website you see this :
public static void CloseUpdateCheckDialog(Ranorex.Core.RxPath myPath, Ranorex.Core.Element myElement)  
{  
 myElement.As<Ranorex.Button>().Click();  
}
In your code you only press the keys without focusing on an element therefore I think it is working it's just that the four actions (tab, tab, space, return) are not performed on your popup.

Therefore just add the popup element to your repository and do something like repo.mypopup.PressKeys("{Tab}")


Regards
A simple thank you always does wonders !

elis
Posts: 15
Joined: Sun Nov 10, 2013 10:27 am

Re: Popup Watcher problem

Post by elis » Wed Dec 11, 2013 3:33 pm

I tried it but still got nothing. the function never invokes (even if I'm just trying to click a button).
I am using Ranorex 4.1.2, does anyone tried to use the Popup Watcher successfully?

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

Re: Popup Watcher problem

Post by Swisside » Wed Dec 11, 2013 4:06 pm

Hello

I found out why it doesn't work.

You forgot to add :
// Start PopupWatcher  
 myPopupWatcher.Start();
:)
A simple thank you always does wonders !

elis
Posts: 15
Joined: Sun Nov 10, 2013 10:27 am

Re: Popup Watcher problem

Post by elis » Wed Dec 11, 2013 4:32 pm

Thank you so much! :)))