As the title says, how can i know if the gecko browser completed loading a web page? I know there is document_completed event. But it will get triggered for every time a web page loads. Are there any other ways to check if the current webpage is completed loading.
My Solotion in vb.net and GeckoFX v45.0.34.0 you can use this tool convert to c# (http://converter.telerik.com/):
Private vWeb As GeckoWebBrowser = New GeckoWebBrowser
Private Property pageready As Boolean = False
Private Sub WaitForPageLoad()
AddHandler vWeb.DocumentCompleted, New EventHandler(Of GeckoDocumentCompletedEventArgs)(AddressOf PageWaiter)
While Not pageready
Application.DoEvents()
End While
pageready = False
End Sub
Private Sub PageWaiter(ByVal sender As Object, ByVal e As GeckoDocumentCompletedEventArgs)
If vWeb.IsBusy = False Then
pageready = True
RemoveHandler vWeb.DocumentCompleted, New EventHandler(Of GeckoDocumentCompletedEventArgs)(AddressOf PageWaiter)
End If
End Sub
Using:
vWeb.Navigate("https://www.google.com")
WaitForPageLoad()
//Do your Work
Hope this solution to resolve.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With