I am trying to create a piece of software to more or less automate the filling out of forms on a web page, and I decided to use the WebBrowser control in System.Windows.Forms . This works fine, and I can easily manipulate the DOM through webbrowser.Document and so on. However, unfortunately, the site I'm doing automation has a file download that runs inside the iframe - and this is where I got stuck, I just can't figure out how to manage the elements inside the iframe DOM.
Ideally, what I would like to do is something like:
HtmlElement iframe = browser.Document.GetElementById("iframe_id"); iframe.InnerDocument.GetElementById("file_upload_input").SetAttribute("value", "myfile.txt");
And then, of course, submit the form inside the iframe - however there is no HtmlElement attribute on the InnerDocument , as far as I can see, and not a single type that I have found so that I can distinguish the HtmlElement so that I can access the internal DOM.
How it's done?
kastermester
source share