本文整理汇总了Java中com.meterware.httpunit.WebForm.getButtonWithID方法的典型用法代码示例。如果您正苦于以下问题:Java WebForm.getButtonWithID方法的具体用法?Java WebForm.getButtonWithID怎么用?Java WebForm.getButtonWithID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.meterware.httpunit.WebForm
的用法示例。
在下文中一共展示了WebForm.getButtonWithID方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testPeakAction
import com.meterware.httpunit.WebForm; //导入方法依赖的package包/类
public void testPeakAction() throws Exception {
WebResponse response = wc.getResponse(webedTestLocation
+ "/test/General/testPeakAction.jsp");
WebForm form = response.getForms()[0];
// Set the value of the field which associated with one action,
// then click the button and execute a second action associated
// with it which peaks at the parameters sent to the action
// associated with the field.
String result = "NEW VALUE";
form.setParameter((response.getElementWithID("FLD").getName()),result);
Button button = form.getButtonWithID("BTN");
button.click();
assertEquals("The target value was not visable", result, wc.getCurrentPage().getText());
}
示例2: testFormUnregister
import com.meterware.httpunit.WebForm; //导入方法依赖的package包/类
public void testFormUnregister() throws Exception {
WebResponse resp = wc.getResponse(webedTestLocation
+ "/test/General/testFormUnregister.jsp");
WebForm form = resp.getForms()[0];
Button button = form.getButtonWithID("testFormUnregister");
String requestId = form.getParameterValue(Constants.RP_REQUEST_ID);
wc.getResponse(webedTestLocation + "/unregister?requestid=" + requestId);
try {
button.click();
fail("Failed to unregister form action data.");
} catch (HttpInternalErrorException e) {
}
}
示例3: clickButton
import com.meterware.httpunit.WebForm; //导入方法依赖的package包/类
/**
* Click on the button with a given ID and on the first form.
* @param buttonID The id of the button to click.
* @throws SAXException
* @throws IOException
*/
protected void clickButton(String buttonID) throws SAXException, IOException {
WebForm forms[] = resp.getForms();
assertTrue(forms.length > 0);
WebForm form = forms[0];
Button button = form.getButtonWithID(buttonID);
assertNotNull(button);
button.click();
resp = wc.getCurrentPage();
}
示例4: clickButton
import com.meterware.httpunit.WebForm; //导入方法依赖的package包/类
/**
* Click on the button with a given ID within the first form.
* @param buttonID The id of the button to click.
* @throws SAXException
* @throws IOException
*/
protected void clickButton(String buttonID) throws SAXException, IOException {
log.debug("Clicking Button: " + buttonID);
WebForm forms[] = resp.getForms();
assertTrue(forms.length > 0);
WebForm form = forms[0];
Button button = form.getButtonWithID(buttonID);
assertNotNull(button);
button.click();
resp = wc.getCurrentPage();
}