I've only started working with watin a few days ago and I'm having a slight problem. I am writing a very simple test to change the text of UserName
. The code is:
Markup
<div class="col-md-10">
<asp:TextBox runat="server" autocomplete="off" ID="UserName" CssClass="form-control" placeholder="Username" />
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="UserName"
CssClass="text-danger" ErrorMessage="The Username field is required." />
</div>
And my Test code is:
[TestClass]
public class TestClass
{
[TestMethod]
public void TestMethod1()
{
using (var browser = new IE("My Url"))
{
browser.TextField(Find.ByName("UserName")).TypeText("some text");
}
}
}
When ever I run the test I keep getting the following error:
Could not find INPUT (hidden) or INPUT (password) or INPUT (text) or INPUT (textarea) or TEXTAREA element tag matching criteria: Attribute 'name' equals 'UserName' at about:blank
I've come across this question but still get the same error. Can someone please tell me where I'm going wrong. Thanks in advance for all your help and support.
Aucun commentaire:
Enregistrer un commentaire