Skip to content

Instantly share code, notes, and snippets.

@dck-jp
Created June 6, 2015 11:09
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dck-jp/1f72d203c38b773ccc37 to your computer and use it in GitHub Desktop.
Save dck-jp/1f72d203c38b773ccc37 to your computer and use it in GitHub Desktop.
SHDocVwSample04
//ページの読み込み完了まで待機するための拡張メソッド
public static class SHDovVwEx
{
public static void Wait(this SHDocVw.InternetExplorer ie, int millisecond = 0)
{
while (ie.Busy == true || ie.ReadyState != SHDocVw.tagREADYSTATE.READYSTATE_COMPLETE)
{
Thread.Sleep(100);
}
Thread.Sleep(millisecond);
}
}
//拡張メソッドの使い方
public void WaitTest()
{
var IE = new SHDocVw.InternetExplorer();
IE.Visible = true;
object URL = "http://www.google.com/";
IE.Navigate2(ref URL);
IE.Wait(); //続いてページ内の要素を書き換えるために、ページが表示されるまで待機
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment