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.
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.
11 Answers, 1 is accepted
Two key things you are missing:
1) At run time Test Studio cannot actually tell the difference between an Alert dialog and a Confirm dialog. They look the same. In your code you can use just the ConfirmDialog for everything.
2) You don't need a handler delegate. I'm surprised it's working at all in IE. Instead you should be resetting the state of the one dialog handler as in this full working example:
the Telerik team
Thanks for your feedback.
I agree with your first point. The Confirm and Alert dialogs are same in the run time.
For your second point, it doesn't resolve my issue.
I'm making a test tool based on the Telerik testing framework.
I want use this tool to monitor and handle all the confirm and alert dialogs automatically, not handled one by one.
So, I use the dialog handler delegate.
In my implementation, the Confirm dialog is added to DialogMornitor.
If the confirm dialog is displayed, the dialog handler delegate will be invoked to handle the dialog.
This implementation will handle all the confirm dialogs.
The point in my issue is:The the dialog handler delegate method (MyCustomConfirmHandler
) is not invoked for firefox browser, but working for IE/Chrome.
I don't why, do you have any ideas about it?
Please let me know if you want more information. Thanks.
I have discovered we do have a bug regarding the HandlerDelegate when running your test with Firefox 4 and above. The HandlerDelegate will not get called under any condition. I have filed a bug report on this here. Hopefully we'll be able to fix this in the near future.
As a result the only option available today is to reset the dialog state as shown in my previous post:
confirmDialog.CurrentState = DialogCurrentState.NotActive;
the Telerik team
this is a great news for us....
I will keep this bug in tracking.
It's appreciated to let me know if there is any update.
BTW, there is another question here.
If you want to find a button in a web page, you can use Browser.Find() method to find the button by button id/Attribute/...
Is there any way to implement this function?
I have went through the sample code,
and found that still cannot resolved our issue.
The code is wondering to get the text from a
The dialog is already got in the sample code.
Currently, our blocking issue is how to capture the JS dialog after it’s popping up?
In the test framework, you can add the dialog to DialogMonitor and the dialog will be handled automatic.
But in our case, we want to handle the JS dialog manual instead of automatic.
That's why we need to capture the dialog firstly.
Please let me know if you want more information. Thanks~
That article demonstrates the Custom Dialog Handler approach, which is what you should use if you want to perform extra tasks before handling the dialog. In that example the text is extracted and the dialog is dismissed by pressing the Enter key. You can easily change that portion of the code to suit your needs.
If that's not what you intended, what do you mean by "capture" the dialog? It cannot be found and acted upon like a standard DOM element through the Framework.
the Telerik team
Thanks for your time and feedback.
As showing in the article “Custom Dialog Handler”, I do want to use HandlerDelegate to handle dialog. But there is a bug as Cody said above.
“regarding the HandlerDelegate when running your test with Firefox 4 and above. The HandlerDelegate will not get called under any condition. “
I cannot use HandlerDelegate in firefox unless the bug is fixed.
It’s OK. I will use a work round solution to solve my issue now.
Thanks all the same.