Re: Question: How to add new parameters to the form of WebResponse object?
"Wolfgang Fahl - BITPlan" <[email protected]>
| Newsgroups | gmane.comp.web.httpunit.devel |
|---|---|
| Organization | bitplan GmbH |
| Message-ID | <[email protected]> |
Lucy wrote:
> I am stuck with the problem. could anybody give me some help?
I don't know whether this helps - but here is how I do a login just for
reference:
import net.sourceforge.jwebunit.WebTester;
...
/**
* login with the given username and passwort
* @param relurl - the relative url to the web app
* @param title - the main page title to check
* @param username
* @param userpassword
* @param refresh - true if autorefresh asked for
* @param assertNoProblem - true if a valid user is used and
assertNoProblem should be invoked
*/
public void login(String relurl, String title, String username,
String password, boolean refresh, boolean assertNoProblem) throws Throwable
{
loginPreparation(relurl,
"/index.php?newsession=true&nojavascriptmenu", title,assertNoProblem);
try {
tester().clickLinkWithText("Login");
} catch (Throwable t) {
watcher().snapShotNow();
throw(t);
}
if (assertNoProblem)
watcher().assertNoProblem();
try {
tester().assertFormPresent("loginform");
tester().assertFormElementPresent("username");
tester().assertFormElementPresent("password");
tester().setFormElement("username", username);
tester().setFormElement("password", password);
tester().setWorkingForm("loginform");
if (refresh) {
System.out.println("auto refresh");
// make sure the refresh of the login is followed
automatically
tester().getTestContext().getWebClient().getClientProperties().setAutoRefre
sh(true);
}
tester().clickButton("dologin");
} catch (Throwable t) {
watcher().snapShotNow();
throw(t);
}
if (assertNoProblem)
watcher().assertNoProblem();
} // login
WolfgangBITPlan - smart solutions
Pater-Delp-Str. 1, D-47877 Willich-Schiefbahn
Tel. +49 1805 - BITPLAN / +49 1805 248 752, Fax +49 2154
811-481
Web: http://www.bitplan.de
bitplan GmbH, Willich - HRB 6820 Krefeld, VAT-ID:
10258040584, Geschäftsführer: Wolfgang Fahl
Mit BITPlan effizient zum Erfolg: http://www.bitplan.de
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/