Thursday, 12 February 2009

WatiN - Firefox with iFrames

I’ve been trying to get my head back into WatiN (WatiN- recently, and came across an issue trying to get hold of the contents of an IFrame.  Using IE, I was able to use an Assert to check the contents of an IPara which resides within an IFrame.  However, running the same code against Firefox, I was unable to get inside ‘Mainwin’, even though FireBug can see it without issue. 

However, having posted a message on the WatiN Users (Sourceforge) Forum, Jeroen van Menen has advised that the next CTP release of WatiN will support iFrames.


public void CheckSplashContentTelephone()


IBrowser browser = BrowserFactory.Create(BrowserType.FireFox);




CMS_Common.LogonDlg.LogonUserNamePassword(browser, "admin", "admin", appname);

Common.LogOn.ImportControl(browser, "Click Here to Skip Download");

Assert.AreEqual(Splash.Telephone(browser).Text.Trim(), "My Phone Number");

Toolbar.ClickButton(browser, Toolbar.Button.LOGOUT);



        public static IPara Telephone(IBrowser browser)


            IFrame mainframe = browser.Frame(Find.ById(mainwin));

            return mainframe.Paras[1];


No comments: