Click here to Skip to main content
13,198,068 members (63,301 online)
Rate this:
Please Sign up or sign in to vote.
See more:

When i clicked the Button one modal pop up dialog box will open, how to click that open button using watin test.

I used below code , but it doesn't working for me.

 public void CheckName()
            IE ie = new IE("http://localhost:4066/SampleWebSite/Default.aspx");

            AlertAndConfirmDialogHandler myHandler = new AlertAndConfirmDialogHandler();
            //Declare an object of HTMLDialog 
            HtmlDialog myModalHandler;
            //The button that opens the HTML dialog must be clicked with NO WAIT 
            ie.Link(Find.ByText("File Download")).ClickNoWait();
            //Hook the PopUp by title/name/type etc. 
            myModalHandler = ie.HtmlDialog(Find.ByTitle(new Regex("Do you want to open or save this file?")));
            //Click on button which is on PopUp window. 
            myModalHandler.Button(new Regex("BtnSubmit")).ClickNoWait();


Posted 7-Feb-12 23:20pm
Updated 8-Feb-12 13:44pm

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web03 | 2.8.171020.1 | Last Updated 8 Feb 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100