[英]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.