C#通过WatiN操作页面中内嵌的Iframe
时间:2014-01-14 21:38:44
收藏:0
阅读:891
通过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();
原文:http://www.cnblogs.com/fengsiyi/p/3513592.html
评论(0)