Hi all,
I'd like to get some information about a dialog window when I close it, so I try to use code like that:
The idea of writing this stuff is here: see "Creating custom dialog handlers" section.
Still it doesn't work at all. The button is pressed, the dialog appears and I collect all the required information (see trace after run).
But the "Cancel" button isn't clicked while the code is very the same as given at the Artoftes site.
OS: WinXP, browser: IE7.
Thanks in advance for any ideas,
Yaroslav
I'd like to get some information about a dialog window when I close it, so I try to use code like that:
public
void
Test1()
{
Settings settings =
new
Settings(BrowserType.InternetExplorer, @
"d:\log\"
);
settings.UnexpectedDialogAction = UnexpectedDialogAction.DoNotHandle;
Manager manager =
new
Manager(settings);
manager.Start();
manager.LaunchNewBrowser();
manager.ActiveBrowser.NavigateTo(
"http://aspspider.ws/kovyar/confirm.htm"
);
Element confButton = manager.ActiveBrowser.Find.ById(
"confirmbutton"
);
manager.DialogMonitor.AddDialog(
new
GenericDialog(manager.ActiveBrowser,
"Explorer"
,
true
, 1));
manager.DialogMonitor.Dialogs[0].HandlerDelegate =
delegate
(IDialog dialog)
{
Trace.WriteLine(dialog.Window.Caption);
Trace.WriteLine(dialog.Window.AllChildren[0].Caption);
Trace.WriteLine(dialog.Window.AllChildren[1].Caption);
Trace.WriteLine(dialog.Window.AllChildren[2].Caption);
Trace.WriteLine(dialog.Window.AllChildren[3].Caption);
Manager.Current.Desktop.Mouse.Click(MouseClickType.LeftClick, dialog.Window.AllChildren[1].Location);
};
manager.DialogMonitor.Start();
(
new
HtmlControl(confButton)).Click();
Thread.Sleep(5000);
manager.DialogMonitor.Stop();
manager.Dispose();
}
The idea of writing this stuff is here: see "Creating custom dialog handlers" section.
Still it doesn't work at all. The button is pressed, the dialog appears and I collect all the required information (see trace after run).
But the "Cancel" button isn't clicked while the code is very the same as given at the Artoftes site.
OS: WinXP, browser: IE7.
Thanks in advance for any ideas,
Yaroslav