::Home::

::Documentation::

::Download::

::Contact::

CSHttpUnit


[1] Obtaining a web page response:
CSWebConversation wc = new CSWebConversation();
CSWebResponse response = wc.GetResponse("http://www...");
String title = response.GetTitle();


[2] Working with Submit Buttons:
CSWebResponse response = _wc.GetResponse("http://localhost/cshttpunittestpage/index.aspx");
CSWebForm form = response.GetFormWithID("index");
CSSubmitButton sb = new CSSubmitButton();
sb.ID = "Button1";
CSWebRequest request = form.GetRequest(sb);
request.SetParameter("TextBox1", "tommi");
request.SetParameter("TextBox2", "tester");
response = _wc.GetResponse(request);
Assert.Equals("heise online", response.GetTitle());


[3] Working with Tables:
CSWebResponse response = _wc.GetResponse(http://...);
Assert.Equals("CSHttpUnit", response.GetTableWithID("testTable").GetCellAsText(0,0));
Assert.Equals(1, response.GetTableWithID("testTable").GetRowCount());


[4] Working with Links:
CSWebResponse response = _wc.GetResponse("http://...");
CSWebLink link = response.GetLinkWithID("sourceforge");
response = _wc.GetResponse(link.URL);
Assert.Equals("CSHttpUnit", response.GetTitle());



© 2003, 2006 Thomas Schübel