http://watin.sourceforge.net/
[TestMethod]
public void TestMethod1()
{
IE ie = new IE("http://www.baidu.com");
for (int i = 0; i < ie.TextFields.Length; i++)
{
TextField tf = ie.TextFields[i];
if (tf.Name == "wd")
{
tf.Value = "风云";
}
}
ie.Forms[0].Submit();
Assert.IsTrue(ie.Url.IndexOf("http://www.baidu.com") != -1);
}
简单写了个 public void TestMethod1()
{
IE ie = new IE("http://www.baidu.com");
for (int i = 0; i < ie.TextFields.Length; i++)
{
TextField tf = ie.TextFields[i];
if (tf.Name == "wd")
{
tf.Value = "风云";
}
}
ie.Forms[0].Submit();
Assert.IsTrue(ie.Url.IndexOf("http://www.baidu.com") != -1);
}
你也可以用这个来做一些简单的自动发贴程序.
更简单的写法
ie.TextField((Find.ByName("wd"))).Value = "54654";