Click here to Skip to main content
12,503,635 members (51,132 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: WaTiN unit-testing
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.

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 7-Feb-12 23:20pm
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)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web01 | 2.8.160919.1 | Last Updated 8 Feb 2012
Copyright © CodeProject, 1999-2016
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