.netwatin

How to test value of the popped up child form using watin?


I want to test a popped up page using watin, but can't find any way to do so?

Is there a property like AlertDialogHandler to do so.....as the child form is also a simple asp.net page.

Example:

I have a parent abc.aspx with one textBox and a button and on the button click a simple popped up a xyz.aspx form and similarly on that form I have a textbox and a button the text will contain some text and on the button click the Textbox will be sent back to the parent form Textbox.


Solution

  • You could probably do something like this:

        HtmlDialog dialog = ie.HtmlDialog(Find.ByTitle("your popup title"));
        dialog.TextField(Find.ById("your textbox id")).TypeText("Whatever");
        dialog.Button(Find.ById("button name on popup")).Click();
        //Perform your assertions accordingly to your ie or dialog.
    

    Without any code it is difficult to determine the type of dialog you're using, but this is a general and should work for most dialog types.