I’ve been trying to get my head back into WatiN (WatiN-2.0.1.754-net-2.0) 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.
[Test]
public void CheckSplashContentTelephone()
{
IBrowser browser = BrowserFactory.Create(BrowserType.FireFox);
browser.GoTo(_loginUri);
browser.Maximize();
Thread.Sleep(3000);
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);
browser.Close();
}
public static IPara Telephone(IBrowser browser)
{
IFrame mainframe = browser.Frame(Find.ById(mainwin));
return mainframe.Paras[1];
}
No comments:
Post a Comment