It is too soon to do anything right after the Navigate call, after that a lot happens with the browser. I'm sure you've witnessed anything from short to long delays before a document display when you are browsing the internet, also called "load time". What happens is that the browser connects to the other site and request a document, which it download and parses the content for, any other resources specified in the document source like script files, style sheets and images is downloaded, things are finally rendered to the combination of elements that displays in the browser window. The Navigate call does not block and wait until all this is done before returning, it returns immediately and will notify clients like you about changes in the browser state using events. What you have to do is to listen to the DocumentCompleted event, here you must check the browsers ReadyState property and see that it reports "Complete" before you attempt to access the Document tree programmatically.
|