V. Vouvonikos
V. Vouvonikos

Reputation: 63

C# WebBrowser DocumentCompleted fires but page is not rendered

Hello I use a WebBrowser to navigate to a url, and then using GetElementByID I do some actions when DocumentCompleted event is fired. The problem is that when the event is fired, the page is not rendered on my screen yet, and the body's InnerHtml is "\n" so the elements I want cannot be found. I have already checked the url in WebBrowserDocumentCompletedEventArgs is the same as WebBrowser's url, so now I've run out of ideas.

Upvotes: 0

Views: 155

Answers (1)

V. Vouvonikos
V. Vouvonikos

Reputation: 63

So it seems that the page was loading content using javascript and although the event fired the content wasn't yet available. It was solved by using timers and checking if content was empty it waited again until content waas found or a certain number of tries was reached

Upvotes: 1

Related Questions