如何自动点击按钮并从网站自动填写输入字段? [英] How to Auto click button and auto fill an input field from a website ?
本文介绍了如何自动点击按钮并从网站自动填写输入字段?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好!
我想填写输入字段html,并通过以下网站以编程方式点击cotation按钮:http://www.wine-searcher.com/wine-valuation- f.lml
请问如何使用asp.net在C#后面的代码中执行此操作?
解决方案
您可以使用其中一个网站测试库/工具,如 WatiN [ ^ ]
示例代码:
[测试]
public void SearchForWatiNOnGoogle()
{
使用( var browser = new IE( http://www.google.com))
{
browser.TextField(Find.ByName( q))。TypeText( WatiN);
browser.Button(Find.ByName( btnG))。点击();
Assert.IsTrue(browser.ContainsText( WatiN));
}
}
您可以在CP中找到许多相关文章 [ ^ ]
Hi everyone !
I want to fill the input field html and click on button "cotation" programmatically from this website: http://www.wine-searcher.com/wine-valuation-f.lml
please how can I do that in code behind C# using asp.net ?
解决方案
You can use one of web site testing libraries/tools like WatiN[^]
sample code:
[Test] public void SearchForWatiNOnGoogle() { using (var browser = new IE("http://www.google.com")) { browser.TextField(Find.ByName("q")).TypeText("WatiN"); browser.Button(Find.ByName("btnG")).Click(); Assert.IsTrue(browser.ContainsText("WatiN")); } }
这篇关于如何自动点击按钮并从网站自动填写输入字段?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文