Note that there are some explanatory texts on larger screens.

plurals
  1. POWaiting for WebBrowser to fully load between multiple Navigate() calls
    primarykey
    data
    text
    <p>I am venturing into WPF - first time in (VB).NET - and trying to re-create a project I started in MS Access VBA. It basically scrapes a series of pages within a web application. As you may have surmised I am having trouble with the LoadCompleted event.</p> <p>I have searched and found some information on it, but the "flow" of the code only lends itself to waiting for one page to load. For example: </p> <p><a href="http://social.msdn.microsoft.com/Forums/nn-NO/wpf/thread/52c1bc55-dd41-468c-8759-a42726635d4b" rel="nofollow">http://social.msdn.microsoft.com/Forums/nn-NO/wpf/thread/52c1bc55-dd41-468c-8759-a42726635d4b</a></p> <p>All of the code execution is run in the DocumentLoaded event which works fine when you just need to navigate to one page and execute code. But I need to perform a series of these cycles for my application. </p> <p>How can I reliably wait for the document to fully load while still keeping the code execution in the same Sub AND not locking the UI thread? </p> <p>Here's a basic idea of what I'm trying to do. </p> <ol> <li>Navigate to page</li> <li>Wait for page to fully load</li> <li>do stuff</li> <li>Navigate to page</li> <li>Rinse, Repeat</li> </ol> <p>P.S - .NET is very new to me so please don't give my brain a stack overflow ;)</p> <p>Thanks, Brian</p> <p><strong>-## EDIT ##-</strong> </p> <p>This is what I use to do in VBA. This is exactly what I'm trying to do, just in the ".NET" way and without blocking the UI Thread:</p> <pre><code>Dim oIE = New SHDocVw.InternetExplorer With oIE .Navigate(strURL) .Visible = False ' loop until the page finishes loading Do While oIE.Busy : Loop Do While oIE.ReadyState &lt;&gt; 4 : Loop 'Code goes here to read DOM, get fields and click a button (logging in to site) 'My code execution is done and now I'm ready to go to the next page and read the DOM .Navigate(strURL) End With </code></pre> <p>. . . .</p> <p>That's it. Repeat for <em>n</em> times. my interactions with each DOM are significantly different. </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload