tags:

views:

41

answers:

1

hi,

I am building an application which opens a website in WebBrowser control and then puts some text in fields and then clicks submits on few buttons one after another.

Have a look at code bellow...

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");

First and last 3 lines work good and even middle 2 works fine but when I RaiseEvent("onclick") in the last line of code, the value of textbox gets blank before being submitted even I've set it in 5th line of code.

The website is built into ASP.NET and I think this is ViewState that is messing up with.

Any ideas?

A: 

As reference, check if the popular iMacros browser macro recorder can handle this website. If yes, then you know at least that it is doable.

Ruby8848