|
Rank: Advanced Member Groups: Member
Joined: 1/12/2015 Posts: 81
|
I've found that sometimes after calling LoadUrl and waiting for the page to be ready, when I call GetHtml the HTML returned is from the previously loaded page and not from the current page. I'm using the multi-DLL version 3.0.100.1.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,196
|
Hi,
During the waiting period you can have previous HTML. However if you use LoadUrlAndWait, you should always get the new HTML after LoadUrlAndWait returns.
Thanks!
|
|
Rank: Advanced Member Groups: Member
Joined: 1/12/2015 Posts: 81
|
This is the code I am using:
Code: Visual Basic.NET
Private m_bLoadingStopped As Boolean
Private Sub WebView_IsLoadingChanged(sender As Object, e As EventArgs)
'Set m_bLoadingStopped to true only when IsLoading
'changes from true to false
If Not webView1.IsLoading Then
m_bLoadingStopped = True
End If
End Sub
'Hook up the event handler in your initialization code
AddHandler webView1.IsLoadingChanged, New EventHandler(AddressOf WebView_IsLoadingChanged)
'Reset m_bLoadingStopped before your page posts back
m_bLoadingStopped = False
Dim t As NavigationTask = wbView1.LoadUrl(strURL)
t.WaitOne(30000)
'Wait for IsLoading changes from true to false
While Not m_bLoadingStopped
webView.DoEvents()
End While
strHTML = wbView1.GetHtml()
The page completely loads within the 30 second time limit but it still has the old HTML.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,196
|
Hi, That is strange. You do not need to use complex logics involving m_bLoadingStopped. You can replace the above code with just two lines of code:
Code: Visual Basic.NET
webView1.LoadUrlAndWait(strUrl)
strHTML = webView1.GetHtml()
If the problem continues, you can try to isolate the problem into a test project and send us the test project. Once we have that we will investigate further. See here for more information about how to send test project: http://www.essentialobjects.com/forum/test_project.aspxThanks!
|
|