C#通过WatiN操作页面中内嵌的Iframe

通过WatiN.Core.Broswer.Frame()方法来获取iframe对象,之后的容器就是frame,然后进行操作。

下面的例子是登录QQ空间的:

Frame frame = browser.Frame(Find.ById("login_frame"));
Link otherLink = frame.Link(Find.ById("switcher_plogin"));
TextField txtName = frame.TextField(Find.ById("u"));
TextField txtPsw = frame.TextField(Find.ById("p")); 
WatiN.Core.Button btnLogin = frame.Button(Find.ById("login_button")); if (otherLink.Exists) otherLink.Click(); txtName.Value = strLine[0].Trim(); txtPsw.Value = strLine[1].Trim(); btnLogin.Click();
原文地址:https://www.cnblogs.com/fengsiyi/p/3513592.html