I use WebBrowser control for my C# project. I try to integrate GeckoFX instead of WebBrowser. Because i always change inputs in WebBrowser, i have to wait till the website loaded completely. That's why, i use following method:
private void navigateBrowser(string URL)
{
wb.Navigate(URL);
while (wb.ReadyState != WebBrowserReadyState.Complete)
{
Thread.Sleep(1);
Application.DoEvents();
}
}
i have changed this method for GeckoFX like this: private void navigateBrowser(string URL)
private void navigateBrowser(string URL)
{
wb.Navigate(URL);
while (wb.Document.ReadyState != "complete")
{
Application.DoEvents();
}
while (wb.IsBusy)
{
Application.DoEvents();
}
}
i call navigateBrowser("http://facebook.com") and then i fill the form for login. After i submit the form, i have to login in another website (in linkedin.com) i call again the navigateBrowser("http://linkedin.com"), when try to call some element from the geckowebbrowser, i get the error "Object reference not set to an instance of an object.". I check the actual URL of the geckowebbrowser, it's still facebook.com, but i should be linkedin.com, because i called linkedin.com.
What can be the problem? How can i solve this issue?