The reason is that with Thread.Sleep() you will simply block the current thread, so it is not that reliable.
Originally Posted by Devils Child
You have to do something like this:
The first part, the most important, while ensure that the Document is completed, thus the page loaded. BUT, sometimes it loads more than once. That is why I have an additional delay. Note that the Delay function is executed from another Thread (delayThread) so it doesn't stop current thread.
private void browser_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
completedLoading = true;
public void LoadPage(string url, bool wait = true)
completedLoading = false;
delaying = true;
delayThread = new Thread(new ParameterizedThreadStart(delayDel));
public static void Delay(object sec)
Thread.Sleep((int)sec * 1000);
delaying = false;
Just a note, I had problems finding links even using the method above. For example I was trying to get links from search engine pages. For most of the part I could, but still somethings were missing, so it might not always be possible to do what you want.