views:

194

answers:

1

Hi folks, i am using WatiN lib for automation test. But some case i have to access a modal dialog which is fired another modal dialog. Above code works fine but last line open a modaldialog again. i can not access it with using ie instance.. any idea ?

        IE ie = new IE("http://localhost/test.htm");
        ie.Link("main_lnk1").ClickNoWait();

        HtmlDialog dialog = ie.HtmlDialog(Find.ByTitle("Modal 1")));

        dialog.TextField("modal1_txt1").Value = "modal 1";
        dialog.Link("modal1_lnk1").ClickNoWait();
A: 

Hi,

i found a workaround for this stiuation..

    IE ie = new IE("http://localhost/test.htm");
    ie.Link("main_lnk1").ClickNoWait();

    HtmlDialog dialog = ie.HtmlDialog(Find.ByTitle("Modal 1")));

    string modalUrl = dialog.Url;
    dialog.Close();
    IE ie2 = new IE(modalUrl);
    ie2.TextField("modal1_txt1").Value = "modal 1";
    ie2.Link("modal1_lnk1").ClickNoWait();

    HtmlDialog dialog = ie2.HtmlDialog(Find.ByTitle("Modal 2")));
lote