本文整理汇总了Java中com.meterware.httpunit.WebForm.setAttribute方法的典型用法代码示例。如果您正苦于以下问题:Java WebForm.setAttribute方法的具体用法?Java WebForm.setAttribute怎么用?Java WebForm.setAttribute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.meterware.httpunit.WebForm
的用法示例。
在下文中一共展示了WebForm.setAttribute方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleToolNb
import com.meterware.httpunit.WebForm; //导入方法依赖的package包/类
private void handleToolNb(WebResponse resp, WebForm form) throws IOException {
String asText = resp.getText();
if (asText.contains("submitForm('reflect')")) {
form.setAttribute("action", form.getAction() + "?method=reflect");
} else {
form.setAttribute("action", form.getAction() + "?method=finish");
}
}
示例2: handleToolWiki
import com.meterware.httpunit.WebForm; //导入方法依赖的package包/类
private WebForm handleToolWiki(WebForm form, String action) throws IOException, SAXException {
// add one random page...
form.setAttribute("action", action + "?dispatch=addPage");
WebResponse nextResp = (WebResponse) new Call(wc, test, username + " adds Wiki page", fillFormArbitrarily(form))
.execute();
form = nextResp.getForms()[1];
// ...and mark the activity to be finished
form.setAttribute("action", action + "?dispatch=finishActivity");
return form;
}
示例3: handleToolGMAP
import com.meterware.httpunit.WebForm; //导入方法依赖的package包/类
private WebResponse handleToolGMAP(WebResponse resp, WebForm[] forms, String asText)
throws IOException, SAXException, InterruptedException {
WebForm wantedForm = null;
Button continueButton = null;
for ( WebForm form: forms) {
continueButton = form.getSubmitButtonWithID(GMAP_CONTINUE_BUTTON);
if (continueButton != null) {
// log.debug("Found a continue button");
wantedForm = form;
wantedForm.setAttribute(GMAP_DISPATCH, GMAP_CONTINUE_METHOD);
break;
}
}
if ( continueButton == null ) {
wantedForm = forms[forms.length-1];
wantedForm.setAttribute(GMAP_DISPATCH, GMAP_FINISH_METHOD);
}
// MockLearner.log.debug(GMAP_DISPATCH + wantedForm.getAttribute(GMAP_DISPATCH));
if ( continueButton != null ) {
// MockLearner.log.debug("handling reflection");
WebResponse nextResp = (WebResponse) new Call(wc, test, username + " submits gmap form", wantedForm).execute();
return handleActivity(nextResp);
}
return (WebResponse) new Call(wc, test, username + " submits gmap form", wantedForm).execute();
}