瓦廷;通过 id 获取元素不起作用
我试图将数据放入隐藏输入内的文本区域,但 watin 找不到它。
当我搜索输入时,我的程序显示以下内容:
var ie = new WatiN.Core.IE("http://facebook.com", true);
ie.ClearCookies(); ie.TextField(WatiN.Core.Find.ById("email")).TypeText(textBoxUsername.Text); ie.TextField(WatiN.Core.Find.ById("pass")).TypeText(textBoxPassword.Text);
ie.Button(WatiN.Core.Find.ByValue("Login")).Click();
ie.Link(WatiN.Core.Find.ByText("Status")).Click();
ie.TextField(WatiN.Core.Find.ById("u362110_11")).TypeText(textBoxPassword.Text);
异常
Could not find INPUT (hidden) or INPUT (password) or INPUT (text) or INPUT (textarea) or TEXTAREA element tag matching criteria: Attribute 'id' equals 'u493403_13' at http://www.facebook.com/home.php
I am trying to place data into text area that is inside hidden input but watin does not find it.
When I search for inputs my program shows this:
var ie = new WatiN.Core.IE("http://facebook.com", true);
ie.ClearCookies(); ie.TextField(WatiN.Core.Find.ById("email")).TypeText(textBoxUsername.Text); ie.TextField(WatiN.Core.Find.ById("pass")).TypeText(textBoxPassword.Text);
ie.Button(WatiN.Core.Find.ByValue("Login")).Click();
ie.Link(WatiN.Core.Find.ByText("Status")).Click();
ie.TextField(WatiN.Core.Find.ById("u362110_11")).TypeText(textBoxPassword.Text);
Exception
Could not find INPUT (hidden) or INPUT (password) or INPUT (text) or INPUT (textarea) or TEXTAREA element tag matching criteria: Attribute 'id' equals 'u493403_13' at http://www.facebook.com/home.php
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
通过按名称搜索替换 id 使其正常工作,因为 id 是动态的并且一直在变化
Got it working by replacing id by searching by name because id was dynamic and changed all the time