![](/img/trans.png)
[英]PreFilterMessage is not called when hosting C# control within Internet Explorer
[英]Control Internet Explorer with C#
有一个网页有输入文本字段。
我要启动页面
Process.Start("http://nameofdomain.com")
问题是如何在字段中输入数据并提交表单?
更新 -
我不需要向用户显示/呈现任何页面。
目的是允许用户以最小的努力更改密码。 我们当前的设置是
您可以研究诸如Selenium之类的Web浏览器自动化工具,它们具有C#驱动程序来与浏览器进行交互并使之自动化。
最好的方法(到目前为止)是WatiN @ http://watin.org/ 。 我尝试过Selenium并且永远无法让它顺利运行(也许它已经变得更好了)。 WatiN的文档面向自动化测试,但您可以不使用测试代码/库,并且它也支持Firefox和Chrome 。 例如:
using WatiN.Core;
using WatiN.Core.Interfaces;
using WatiN.Core.Logging;
using WatiN.Core.DialogHandlers;
...
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();
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.