2011-01-09 42 views
1

我想将数据放入隐藏输入内的文本区域,但watin没有找到它。Watin;通过ID获取元素不工作

当我搜索输入我的程序显示了这一点:

alt text

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 
+0

请向我们显示您的代码。 – SLaks 2011-01-09 17:35:10

+1

上面的HTML没有id(“u493404_13”)您确定HTML和代码是正确的吗?虽然很难阅读你的HTML代码,所以有可能我错过了它 – Sparky 2011-01-09 17:44:36

回答

4

得到它的工作由按名称搜索更换ID,因为ID是动态的,变化所有时间