Invoking an html button in a WebBrowser control
-
Hi, I am making an application in VSC# 2005 which has a "WebBrowser" control in it, I want to be able to manipulate a webpage in the webrowser control from within the application. I have worked out how to get (and set) the text in a form on the webpage with something like; webBrowser1.Document.GetElementById("Textbox1").InnerText.ToString(); which is fine, but I just can't work out how to invoke a button on the webpage. Basically I want to get the text from the form, change it, paste it back into the form (all of which I can do) and then call the "Save" button to save my changes (which I can't do). Any help would be greatly appreciated! Thanks in advance, Martin.
-
Hi, I am making an application in VSC# 2005 which has a "WebBrowser" control in it, I want to be able to manipulate a webpage in the webrowser control from within the application. I have worked out how to get (and set) the text in a form on the webpage with something like; webBrowser1.Document.GetElementById("Textbox1").InnerText.ToString(); which is fine, but I just can't work out how to invoke a button on the webpage. Basically I want to get the text from the form, change it, paste it back into the form (all of which I can do) and then call the "Save" button to save my changes (which I can't do). Any help would be greatly appreciated! Thanks in advance, Martin.
OK I worked out one way, by putting the user focus on the correct button, then simulating pressing the enter key; webBrowser1.Document.GetElementById("Save").Focus(); SendKeys.Send("{ENTER}"); but it's pretty ugly, and possibly not very robust. Anyone got any better ideas? thanks