I create an application that opens a website in a WebBrowser control, and then puts some text in the fields, and then clicks a few buttons one by one.
Take a look at the code below ...
var doc = webBrowser1.Document.GetElementById ("ddlOnBoro");
doc.SetAttribute ("SelectedIndex", "3");
var temp = doc.InvokeMember ("change");
doc = doc.Document.GetElementById ("iddOnstreet_txTextBox");
doc.SetAttribute ("value", "ASTOR PLACE");
var adoc = doc.Document.GetElementById ("Button6");
var getCrossStreets = adoc.DomElement as mshtml.HTMLInputButtonElement;
adoc.RaiseEvent ("onclick");
The first and last 3 lines work fine, and even the middle 2 works fine, but when I'm in RaiseEvent ("onclick") in the last line of code, the value of the text field becomes empty before sending, even I set it in the 5th line of code.
The website is embedded in ASP.NET, and I think it is a ViewState that is messed up.
Any ideas?
c # browser
Neutralizer
source share