Click here to Skip to main content
15,885,868 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

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.

C#
public void CheckName()
       {
           IE ie = new IE("http://localhost:4066/SampleWebSite/Default.aspx");
           ie.TextField(Find.ById("txtNickName")).TypeText("Suresh");
           ie.Button(Find.ById("btnCheck")).Click();


           AlertAndConfirmDialogHandler myHandler = new AlertAndConfirmDialogHandler();
           //Declare an object of HTMLDialog
           HtmlDialog myModalHandler;
           ie.AddDialogHandler(myHandler);
           //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();


       }

Thanks
Posted
Updated 8-Feb-12 13:44pm
v2

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900