REQUEST A DEMO

Tag: watin

Scenario Testing With Watin

July 16, 2008   We are starting to use WatiN to automate the testing of a web application. So far it is working pretty well. One of the things I found confusing was handling confirmation alerts like this:       Pop-ups like this need to be handled by Watin. The code for handling this looks like this.   //setup a handler with Watin var confirmDialogHandler = new ConfirmDialogHandler(); browser.DialogWatcher.Add(confirmDialogHandler); //click the button that causes a confirmation pop-up browser.Element("buttonId").ClickNoWait(); //Clickon the ok button of the confirmation window. confirmDialogHandler.WaitUntilExists(); confirmDialogHandler.OKButton.Click(); browser.WaitForComplete(); //You may want to test that the message is correct. //cleanup browser.DialogWatcher.RemoveAll(confirmDialogHandler);   There is a lot of setup and teardown for the simply clicking a button. Using some .Net 3.5 goodness I created an extension method to make this a little more terse.   //usage Browser.OkButtonClickedOnConfirmDialog(ClickOnUnMarkMasterButton); //could use a lambda but this utilty method…