public
HtmlSpan Link
{
get
{
return
Get<HtmlSpan>(
"TextContent="
+ _link,
"tagname=span"
);
}
}
public
class
ExpressionDefinitions
{
private
HtmlFindExpression _link;
public
ExpressionDefinitions(
string
link)
{
string
textcontent =
"TextContent="
+ link;
_link =
new
HtmlFindExpression(textcontent,
"tagname=span"
);
}
public
HtmlFindExpression Link {
get
{
return
_link; } }
public
HtmlFindExpression LogOff =
new
HtmlFindExpression(
"tagname=button"
,
"TextContent=Log Off"
);
}
Hi,
everybody
I am having a problem while handling IE8 download_complete window.The code I am using is below--
private bool DownloadExportedFile(string diskpath, FrameworkElement downloadButton)
{
//download dialog handler
DownloadDialogsHandler downloadHandler = new DownloadDialogsHandler(Manager.Current.ActiveBrowser, DialogButton.SAVE, diskpath, Manager.Current.Desktop);
Manager.Current.DialogMonitor.Start();
//trigger download event
downloadButton.User.Click();
//invoke handler
downloadHandler.WaitUntilHandled(80000);
}
The code works fine for a particular file(.xlsx format,size 10.7 KB ) but when i use the same code for a different file(.zip format,size 342 bytes) it works as excepted for the initial download dialog and then for resulting save as dialog but it does not handle the resulting download complete dialog as it does not click on its close button. As a result this window remains open.I am on windows 7 with ie 8.
var _fileUploadDlg =
new
FileUploadDialog(WebAii.Manager.ActiveBrowser,
"fileName"
,
DialogButton.OPEN,
"Open"
);
WebAii.Manager.DialogMonitor.AddDialog(_fileUploadDlg);
WebAii.Manager.DialogMonitor.Start();
// click on some element to open dialog
_fileUploadDlg.WaitUntilHandled(30000);
WebAii.Manager.DialogMonitor.Stop();
WebAii.Manager.DialogMonitor.RemoveDialog(_fileUploadDlg);
With new 2011.2.1413.0 version the Open file dialog is appeared but the file is not selected. I have the error:
Message
System.TimeoutException : Timed out waiting '30000' msec. for any dialog to be handled '1'
Stack Trace
at ArtOfTest.WebAii.Win32.Dialogs.BaseDialog.WaitUntilAnyHandled(IEnumerable`1 dialogs, Int32 handleCount, Int64 timeoutMilliseconds, Boolean resetHandleCount)
at ArtOfTest.WebAii.Win32.Dialogs.BaseDialog.WaitUntilHandled(Int32 handleCount, Int32 timeout, Boolean resetHandleCount)
at ArtOfTest.WebAii.Win32.Dialogs.BaseDialog.WaitUntilHandled(Int32 timeout)
...
Was the dialog handling approach changed? May be it is somehow related to the reported defect concerning ConfirmDialog and AlertDialog http://www.telerik.com/support/pits.aspx#/public/test-studio/9855 ?
Look forward to your advice.
Thanks.
public
void
Upload(
string
filePath)
{
//((HtmlInputFile) TelerikHtmlWrapper).Upload(filePath, GlobalConst.FileUploadDialogTimeout);
Manager manager = CoreManager.GetCurrentManagerObj();
FileUploadDialog fDialog =
new
FileUploadDialog(TelerikHtmlWrapper.OwnerBrowser, filePath, DialogButton.OPEN);
manager.DialogMonitor.Start();
manager.DialogMonitor.AddDialog(fDialog);
TelerikHtmlWrapper.Click();
fDialog.WaitUntilHandled();
manager.DialogMonitor.Stop();
}
Hi Telerik team,
I want to hand all Confirm and Alert dialogs in multiple
browsers (IE/Firefox/Chrome) automatically.
The following code is my implementation.
manager.Settings.UnexpectedDialogAction = UnexpectedDialogAction.DoNotHandle;
public
static
void
AddDialogHandlers(Manager manager, EventHandler dialogDisplayedHandler)
{
manager.DialogMonitor.RemoveDialogs();
//// Add dialog handler for ConfirmDialog.
ConfirmDialog confirmDialog = ConfirmDialog.CreateConfirmDialog(manager.ActiveBrowser, DialogButton.OK);
confirmDialog.HandlerDelegate =
new
DialogHandlerDelegate(MyCustomConfirmHandler);
manager.DialogMonitor.AddDialog(confirmDialog);
//// Add dialog handler for AlertDialog.
AlertDialog alertDialog = AlertDialog.CreateAlertDialog(manager.ActiveBrowser, DialogButton.OK);
alertDialog.HandlerDelegate =
new
DialogHandlerDelegate(MyCustomAlertHandler);
manager.DialogMonitor.AddDialog(alertDialog);
// Add more dialogs here...
manager.DialogMonitor.Start();
}
public
static
void
MyCustomConfirmHandler(IDialog dialog)
{
dialog.HandlerDelegate =
null
;
dialog.Handle();
dialog =
null
;
Manager.Current.DialogMonitor.RemoveDialog(dialog);
ConfirmDialog confirmDialog = ConfirmDialog.CreateConfirmDialog(Manager.Current.ActiveBrowser, DialogButton.OK);
confirmDialog.HandlerDelegate =
new
DialogHandlerDelegate(MyCustomConfirmHandler);
Manager.Current.DialogMonitor.AddDialog(confirmDialog);
}
public
static
void
MyCustomAlertHandler(IDialog dialog)
{
dialog.HandlerDelegate =
null
;
dialog.Handle();
dialog =
null
;
Manager.Current.DialogMonitor.RemoveDialog(dialog);
ConfirmDialog confirmDialog = ConfirmDialog.CreateConfirmDialog(Manager.Current.ActiveBrowser, DialogButton.OK);
confirmDialog.HandlerDelegate =
new
DialogHandlerDelegate(MyCustomAlertHandler);
Manager.Current.DialogMonitor.AddDialog(confirmDialog);
}
The dialogs are handled well in IE and Chrome, but both of them can't be handled correctly in Firefox.
In Firefox, the Confirm and Alert dialog just can be handled for the first time they display, and not handled any more from second time.
From debugging, I found that the MyCustomConfirmHandler and MyCustomAlertHandler methods are not invoked when the browser is Firefox. (They are invoked if the browser is IE or Chrome.)
Seems the Customized Dialog handle method does not work in Firefox.
So, is there anything else needs to do for
Confirm and Alert dialogs in Firefox?
I'm looking forward for your feedback. Thanks.
Regards,
Jeffery