您的位置:首页 > 编程语言 > C#

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

2014-01-10 13:36 141 查看
通过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();
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: