Sunday 15 March 2015

C# Watin - Skipping the iteration whenever browser throws a popup (message from webpage) -


WATIN is unable to catch the browser popup with IE 9. Instead of leaving it and the rest of the program if such a popup is thrown, is it possible to leave in such fashion?

Popups are JavaScript popups.

You have mentioned that popups are JS popups, you can not ignore them and continue because The main window of the browser is highlighted and the control popup comes on the message.

You can try

  var browser = new IE (); Var url = "someurl"; Browser.GoTo (url);   

// A popup aperce after some navigation

// When the control of the popup does not return automatically to the code and gives a timeout, while IE The busy exception was.

So we need to use it here

  somebtton.ClickNoWait () // Click in the browser case. GoToNoWait () // Just in the case of pop-ups that appear after navigation. // AlertDialogHandler AlertDialog = New AlertDialogHandler () appears if // Warning dialog is found; To check {// code try the case number is invalid and a dialog box appears. Settings. Autostart dealogue = true; Settings. Etchlodydialogs = true; Browser.AddDialogHandler (AlertDialog); AlertDialog.WaitUntilExists (); // If the warning dialog is found then close the dialog and log the error (AlertDialog.Exists ()) // // click the OK button of the dialog so that the dialog stops AlertDialog.OKButton.Click (); Browser.WaitForComplete (); Browser.RemoveDialogHandler (AlertDialog); }} Hold {// removes the Dialog handler if the dialog does not appear within 30 seconds. Browser.RemoveDialogHandler (AlertDialog); }   

Try it out and if you still face the problem, show some code what you are doing.

No comments:

Post a Comment