Welcome Guest Search | Active Topics | Sign In | Register

GetHtml is getting HTML from the previous page Options
BenjaminSimpson1989
Posted: Tuesday, April 21, 2015 11:39:10 AM
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.
eo_support
Posted: Tuesday, April 21, 2015 10:37:56 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,080
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!
BenjaminSimpson1989
Posted: Wednesday, April 22, 2015 3:49:08 PM
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.
eo_support
Posted: Wednesday, April 22, 2015 4:04:34 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,080
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.aspx

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.