Is the VS 2005 Webbrowser really ready for prime time?
-
I am trying to use the Webbrowser control that is available in VS 2005 C# Express (.NET 2.0) to automate navigation through a set of web pages programmatically. I've run into two situations where I cannnot access the OuterHtml property of an HtmlElement. Looking at the debugger seems to say that some kind of underlying exception occurs. 1. I want to select an item in a listbox on a web page by changing the OuterHtml of two of the member elements from: to The attempt to remove the 'selected' string from the first entry fails completely and even messes up the entire listbox 2. I want to iterate through the frames on a web page to find the one I want to enter some text into. When I try to access (read, not write) the OuterHtml property of a frame to see if it is the one I want I see some kind of access violation in the debugger. Shouldn't this work? Does it make sense to try to use the unmananged interfaces IHTMLDocument, IHTMLDocumet2, etc. when the Webbrowser fails like this? Can I mix the use of the Webbrowser control with use of the unmanaged interfaces?
-
I am trying to use the Webbrowser control that is available in VS 2005 C# Express (.NET 2.0) to automate navigation through a set of web pages programmatically. I've run into two situations where I cannnot access the OuterHtml property of an HtmlElement. Looking at the debugger seems to say that some kind of underlying exception occurs. 1. I want to select an item in a listbox on a web page by changing the OuterHtml of two of the member elements from: to The attempt to remove the 'selected' string from the first entry fails completely and even messes up the entire listbox 2. I want to iterate through the frames on a web page to find the one I want to enter some text into. When I try to access (read, not write) the OuterHtml property of a frame to see if it is the one I want I see some kind of access violation in the debugger. Shouldn't this work? Does it make sense to try to use the unmananged interfaces IHTMLDocument, IHTMLDocumet2, etc. when the Webbrowser fails like this? Can I mix the use of the Webbrowser control with use of the unmanaged interfaces?
My guess is that the managed web browser is failing because the underlying unmanaged browser is failing. You can try though; you can mix the managed layer with the underlying native interfaces. You can do this by casting the webBrowser.Document.DomDocument object to IHtmlDocument2 and going from there.
Tech, life, family, faith: Give me a visit. I'm currently blogging about: Is Jesus the Jewish Messiah? The apostle Paul, modernly speaking: Epistles of Paul Judah Himango