我需要單擊一個html按鈕並導航到另一個頁面。點擊後我需要等待頁面加載,並且只有在加載舊頁面時才轉到新頁面。C#WebBrowser按鈕單擊,然後轉到另一頁
下面是代碼,即點擊一個按鈕:
element = webBrowser1.Document.GetElementById("LoginButton");
element.InvokeMember("click");
web瀏覽器得到了一個IsBusy屬性,但它不`噸按鈕,點擊後的工作:
element = webBrowser1.Document.GetElementById("LoginButton");
element.InvokeMember("click");
if(webBrowser1.IsBusy)
{
MessageBox.Show("Busy"); // Nothing happens, but page is not full loaded.
}
如果我添加System.Threading.Thread.Sleep(1000)
的頁面加載,我可以進入下一頁,但在其他計算機上的頁面加載時間可能更多。
我能做些什麼來加載其他頁面之前的頁面加載之後才?
P.S:我是來自俄羅斯,對於英語不好很抱歉。