Page 1 of 1

How to deal with a pop-up window

Posted: Tue Oct 08, 2013 12:01 am
by todd5359
I have a pop-up logon window, and I want to implement "close" the window if it pops up and move to next recording module if it doesn't pop-up. I use user code module and it shows as follows. It works if the window pops up, but it doesn't work if the window doesn't pop-up. How can I exist this user-module and move to my next recording module if the window doesn't pop up?

Thanks a lot :P
using System;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
using System.Drawing;
using System.Threading;
using WinForms = System.Windows.Forms;

using Ranorex;
using Ranorex.Core;
using Ranorex.Core.Testing;

namespace TestWithPB
{
public partial class Recording1
{
/// <summary>
/// This method gets called right after the recording has been started.
/// It can be used to execute recording specific initialization code.
/// </summary>
private void Init()
{
// Your recording specific initialization code goes here.
}

public void UserCodeModule1()
{

var logOn = repo.LogOn.LogOn;
var cancel = repo.LogOn.Cancel;

if (logOn.Visible)
{
cancel.Click();
}
else {return;}
}

}
}

Re: How to deal with a pop-up window

Posted: Thu Oct 10, 2013 1:26 pm
by Support Team
Hello,

I recommend to use our PopupWatcher class to implement this functionality.
Please take a look at Handling Unexpected Dialogs in our User Guide.

Regards,
Markus (T)