I have been trying to do this for ages, even looked at:
C# WebBrowser control — Get Document Elements After AJAX?
With no luck.
Basically, I need to interact with elements that are generated at runtime using javascript on the webpage.
As you all know, when you generate an element at runtime using javascript, it doesn’t show in the “view source”, and thus it does not show when I request WebBrowser.DocumentText.
I am sure there is a way to do this, but there is no information anywhere about this.
Can someone break the ice and tell me how to do it?
Thanks
If you also control the web page that you are viewing within the WebBrowser control, then you could expose JavaScript methods that return what you need and use Document.InvokeScript to get the value from the JavaScript method.
C#:
JavaScript:
If you don’t have control over the web site, then you could interact with the document of the webpage through the Document property as that is a .NET object representing the HtmlDocument:
http://msdn.microsoft.com/en-us/library/system.windows.forms.htmldocument.aspx