本文整理汇总了Java中com.meterware.httpunit.HTMLElement类的典型用法代码示例。如果您正苦于以下问题:Java HTMLElement类的具体用法?Java HTMLElement怎么用?Java HTMLElement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
HTMLElement类属于com.meterware.httpunit包,在下文中一共展示了HTMLElement类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: testDeleteAllSubnets
import com.meterware.httpunit.HTMLElement; //导入依赖的package包/类
public void testDeleteAllSubnets() throws InstantiationException, IllegalAccessException,
ClassNotFoundException, SQLException, IOException, SAXException
{
TestUtils theTestUtils = new TestUtils();
WebResponse response = loadUrl (theTestUtils);
WebForm configurationForm = response.getFormWithID("config");
int numSubnets = Integer.parseInt(configurationForm.getParameterValue("numSubnets"));
String aux = "?";
for (int i = 1; i <= numSubnets; i++)
aux += "delSubnet"+i+"=delSubnet"+i+"&";
aux +="numSubnets="+numSubnets;
WebRequest request = new GetMethodWebRequest(theTestUtils.getUrlPmgraph() + "configure.jsp"+aux);
response = m_conversation.getResponse(request);
configurationForm = response.getFormWithID("config");
int newNumSubnets = Integer.parseInt(configurationForm.getParameterValue("numSubnets"));
assertEquals(numSubnets, newNumSubnets);
HTMLElement result = response.getElementWithID("unsuccessResult");
String resultString = result.getNode().getFirstChild().getNextSibling().getFirstChild().getNodeValue();
assertTrue(resultString.equals("You can't delete all the subnets"));
}
开发者ID:aptivate,项目名称:pmgraph,代码行数:23,代码来源:TestMultiSubnets.java
示例2: doTest
import com.meterware.httpunit.HTMLElement; //导入依赖的package包/类
/**
* No exception when an invalid page is requested.
* @param jspName jsp name, with full path
* @throws Exception any axception thrown during test.
*/
@Override
@Test
public void doTest() throws Exception
{
WebRequest request = new GetMethodWebRequest(getJspUrl(getJspName()));
ParamEncoder encoder = new ParamEncoder("table");
request.setParameter(encoder.encodeParameterName(TableTagParameters.PARAMETER_PAGE), "9");
WebResponse response = runner.getResponse(request);
if (log.isDebugEnabled())
{
log.debug(response.getText());
}
HTMLElement pagination = response.getElementWithID("pagination");
Assert.assertNotNull("Paging banner not found.", pagination);
Assert.assertEquals("Pagination links are not as expected.", "7, 8, [9], 10, 11", pagination.getText());
}
开发者ID:webbfontaine,项目名称:displaytag,代码行数:26,代码来源:Displ109Test.java
示例3: doTest
import com.meterware.httpunit.HTMLElement; //导入依赖的package包/类
/**
* Last page should be loaded.
* @param jspName jsp name, with full path
* @throws Exception any axception thrown during test.
*/
@Override
@Test
public void doTest() throws Exception
{
WebRequest request = new GetMethodWebRequest(getJspUrl(getJspName()));
ParamEncoder encoder = new ParamEncoder("table");
request.setParameter(encoder.encodeParameterName(TableTagParameters.PARAMETER_PAGE), "3");
WebResponse response = runner.getResponse(request);
if (log.isDebugEnabled())
{
log.debug(response.getText());
}
HTMLElement pagination = response.getElementWithID("pagination");
Assert.assertNotNull("Paging banner not found.", pagination);
Assert.assertEquals("Pagination links are not as expected.", "1, [2]", pagination.getText());
}
开发者ID:webbfontaine,项目名称:displaytag,代码行数:26,代码来源:Displ212Test.java
示例4: checkResponse
import com.meterware.httpunit.HTMLElement; //导入依赖的package包/类
/**
* @param response
* @throws SAXException
*/
private void checkResponse(WebResponse response) throws SAXException, IOException
{
if (log.isDebugEnabled())
{
log.debug(response.getText());
}
WebTable[] tables = response.getTables();
Assert.assertEquals("Wrong number of tables.", 1, tables.length);
Assert.assertEquals("Wrong number of rows.", 2, tables[0].getRowCount());
Assert.assertEquals("Column content missing?", "ant", tables[0].getCellAsText(1, 0));
HTMLElement pagination = response.getElementWithID("pagination");
Assert.assertNotNull("Paging banner not found.", pagination);
Assert.assertEquals("Pagination links are not as expected.", "1, 2, [3]", pagination.getText());
Assert.assertEquals(
"Column 1 should be marked as sorted.",
"sortable sorted order2",
tables[0].getTableCell(0, 0).getClassName());
}
开发者ID:webbfontaine,项目名称:displaytag,代码行数:27,代码来源:Displ125Test.java
示例5: doTest
import com.meterware.httpunit.HTMLElement; //导入依赖的package包/类
/**
* The last page should show up in the list.
* @param jspName jsp name, with full path
* @throws Exception any axception thrown during test.
*/
@Override
@Test
public void doTest() throws Exception
{
WebRequest request = new GetMethodWebRequest(getJspUrl(getJspName()));
ParamEncoder encoder = new ParamEncoder("table");
request.setParameter(encoder.encodeParameterName(TableTagParameters.PARAMETER_PAGE), "9");
WebResponse response = runner.getResponse(request);
if (log.isDebugEnabled())
{
log.debug(response.getText());
}
HTMLElement pagination = response.getElementWithID("pagination");
Assert.assertNotNull("Paging banner not found.", pagination);
Assert.assertEquals("Pagination links are not as expected.", "6, 7, 8, [9], 10", pagination.getText());
}
开发者ID:webbfontaine,项目名称:displaytag,代码行数:26,代码来源:Displ213Test.java
示例6: doTest
import com.meterware.httpunit.HTMLElement; //导入依赖的package包/类
/**
* Check sorted column.
* @param jspName jsp name, with full path
* @throws Exception any axception thrown during test.
*/
@Override
@Test
public void doTest() throws Exception
{
WebRequest request = new GetMethodWebRequest(getJspUrl(getJspName()));
ParamEncoder pe = new ParamEncoder("table");
request.setParameter(pe.encodeParameterName(TableTagParameters.PARAMETER_PAGE), "2");
WebResponse response = runner.getResponse(request);
if (log.isDebugEnabled())
{
log.debug("RESPONSE: " + response.getText());
}
// <span class="pagebanner">3 items found, displaying 1 to 1.</span>
HTMLElement pagebanner = response.getElementWithID("pagebanner");
Assert.assertEquals("Wrong page banner", "4|3|4", pagebanner.getText());
}
开发者ID:webbfontaine,项目名称:displaytag,代码行数:27,代码来源:Displ304Test.java
示例7: doTest
import com.meterware.httpunit.HTMLElement; //导入依赖的package包/类
/**
* @param jspName jsp name, with full path
* @throws Exception any axception thrown during test.
*/
@Override
@Test
public void doTest() throws Exception
{
WebRequest request = new GetMethodWebRequest(getJspUrl(getJspName()));
WebResponse response = runner.getResponse(request);
if (log.isDebugEnabled())
{
log.debug(response.getText());
}
HTMLElement divtotal = response.getElementWithID("divtotal");
Assert.assertEquals("7.0", divtotal.getText());
WebTable[] tables = response.getTables();
Assert.assertEquals("Wrong number of tables.", 1, tables.length);
WebTable table = tables[0];
Assert.assertEquals("Wrong number of rows.", 5, table.getRowCount());
Assert.assertEquals("Total not found in las row.", "7.0", table.getCellAsText(4, 0));
}
开发者ID:webbfontaine,项目名称:displaytag,代码行数:29,代码来源:Displ199Test.java
示例8: getDelegates
import com.meterware.httpunit.HTMLElement; //导入依赖的package包/类
protected ScriptableDelegate[] getDelegates( final HTMLElement[] elements ) {
ScriptableDelegate[] result = new ScriptableDelegate[ elements.length ];
for (int i = 0; i < elements.length; i++) {
result[i] = (ScriptableDelegate) elements[i].getScriptingHandler();
}
return result;
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:8,代码来源:ScriptableDelegate.java
示例9: getDelegates
import com.meterware.httpunit.HTMLElement; //导入依赖的package包/类
protected ScriptableDelegate[] getDelegates( final HTMLElement[] elements ) {
ScriptableDelegate[] result = new ScriptableDelegate[ elements.length ];
for (int i = 0; i < elements.length; i++) {
result[i] = elements[i].getScriptableDelegate();
}
return result;
}
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:8,代码来源:ScriptableDelegate.java
示例10: testImageUrlWithGroups
import com.meterware.httpunit.HTMLElement; //导入依赖的package包/类
public void testImageUrlWithGroups() throws IOException, SQLException, InstantiationException, IllegalAccessException, ClassNotFoundException, SAXException
{
HTMLElement theImage = m_response.getElementWithID("graphimage");
String imageUrl = theImage.getAttribute("src");
String expectedUrl = "graphservlet?start=" + m_startTime + "&end=" + m_endTime + "&width=780" +
"&height=350&resultLimit=5&view=LOCAL_IP" +
"&selectGroupIndex=Test";
assertEquals(expectedUrl, imageUrl);
}
开发者ID:aptivate,项目名称:pmgraph,代码行数:11,代码来源:UrlBuilderTest.java
示例11: testTrimAttributeFalse
import com.meterware.httpunit.HTMLElement; //导入依赖的package包/类
public void testTrimAttributeFalse () throws Exception {
WebResponse resp = wc.getResponse(webedTestLocation
+ "/test/FieldTag/testTrimAttributeFalse.jsp");
String original = wc.getResponse(webedTestLocation
+ "/test/FieldTag/value.txt").getText();
HTMLElement field = resp.getElementWithID("FLD");
WebForm form = resp.getForms()[0];
String value = form.getParameterValue(field.getName());
// Trimming should not be carried out
assertEquals("Trimming occurred", original, value);
}
开发者ID:ontopia,项目名称:ontopia,代码行数:16,代码来源:FieldTagTest.java
示例12: getFieldValue
import com.meterware.httpunit.HTMLElement; //导入依赖的package包/类
/**
* Check the contents of a given input field.
* @param fieldID The ID of the field.
* @throws SAXException
*/
protected String getFieldValue(String fieldID, WebResponse response)
throws SAXException {
HTMLElement field = response.getElementWithID(fieldID);
assertNotNull(field);
WebForm forms[] = response.getForms();
assertTrue(forms.length > 0);
WebForm form = forms[1];
return form.getParameterValue(field.getName());
}
开发者ID:ontopia,项目名称:ontopia,代码行数:15,代码来源:FieldTagTest.java
示例13: changeField
import com.meterware.httpunit.HTMLElement; //导入依赖的package包/类
/**
* Change the contents of a given input field.
* @param fieldID The ID of the field.
* @param newValue The new value to put in the input field.
* @throws SAXException
*/
protected void changeField(String fieldID, String newValue,
WebResponse response)
throws SAXException {
HTMLElement field = response.getElementWithID(fieldID);
assertNotNull(field);
WebForm forms[] = response.getForms();
assertTrue(forms.length > 0);
WebForm form = forms[1];
form.setParameter(field.getName(), newValue);
}
开发者ID:ontopia,项目名称:ontopia,代码行数:17,代码来源:FieldTagTest.java
示例14: changeField
import com.meterware.httpunit.HTMLElement; //导入依赖的package包/类
/**
* Change the contents of a given input field.
* @param fieldID The ID of the field.
* @param newValue The new value to put in the input field.
* @throws SAXException
*/
protected void changeField(String fieldID, String newValue)
throws SAXException {
WebForm forms[] = resp.getForms();
WebForm form = forms[0];
HTMLElement field = resp.getElementWithID(fieldID);
assertNotNull(field);
form.setParameter(field.getName(), newValue);
}
开发者ID:ontopia,项目名称:ontopia,代码行数:15,代码来源:AccessctlTest.java
示例15: checkField
import com.meterware.httpunit.HTMLElement; //导入依赖的package包/类
/**
* Check the contents of a given input field against a control value.
* @param fieldID The ID of the field to control.
* @param controlValue The value to check the field contents against.
* @throws SAXException
*/
protected void checkField(String fieldID, String controlValue)
throws SAXException {
HTMLElement field = resp.getElementWithID(fieldID);
assertNotNull(field);
WebForm[] forms = resp.getForms();
assertTrue("more than 0 forms", forms.length > 0);
WebForm form0 = forms[0];
String value = form0.getParameterValue(field.getName());
assertEquals(fieldID, controlValue, value);
}
开发者ID:ontopia,项目名称:ontopia,代码行数:17,代码来源:AccessctlTest.java
示例16: changeField
import com.meterware.httpunit.HTMLElement; //导入依赖的package包/类
/**
* Change the contents of a given input field.
* @param fieldID The ID of the field.
* @param newValue The new value to put in the input field.
* @throws SAXException
*/
protected void changeField(String fieldID, String newValue)
throws SAXException {
HTMLElement field = resp.getElementWithID(fieldID);
assertNotNull(field);
WebForm forms[] = resp.getForms();
assertTrue(forms.length > 0);
WebForm form = forms[0];
form.setParameter(field.getName(), newValue);
log.debug("Changed Field: fieldID=" + fieldID + " newValue=" + newValue);
}
开发者ID:ontopia,项目名称:ontopia,代码行数:17,代码来源:AccessctlRandomizedTest.java
示例17: testWithPlacement
import com.meterware.httpunit.HTMLElement; //导入依赖的package包/类
/**
* @param placement
* @throws MalformedURLException
* @throws IOException
* @throws SAXException
*/
private void testWithPlacement(String placement) throws MalformedURLException, IOException, SAXException
{
ParamEncoder encoder = new ParamEncoder("table");
String mediaParameter = encoder.encodeParameterName(TableTagParameters.PARAMETER_EXPORTTYPE);
WebRequest request = new GetMethodWebRequest(getJspUrl(getJspName()));
request.setParameter("placement", placement);
WebResponse response = runner.getResponse(request);
HTMLElement[] elements = response.getElementsWithClassName("testitem");
if (StringUtils.equals(placement, "top"))
{
Assert.assertEquals(2, elements.length);
Assert.assertEquals("SPAN", elements[0].getTagName());
Assert.assertEquals("TABLE", elements[1].getTagName());
}
else if (StringUtils.equals(placement, "bottom"))
{
Assert.assertEquals(2, elements.length);
Assert.assertEquals("TABLE", elements[0].getTagName());
Assert.assertEquals("SPAN", elements[1].getTagName());
}
else if (StringUtils.equals(placement, "both"))
{
Assert.assertEquals(3, elements.length);
Assert.assertEquals("SPAN", elements[0].getTagName());
Assert.assertEquals("TABLE", elements[1].getTagName());
Assert.assertEquals("SPAN", elements[2].getTagName());
}
}
开发者ID:webbfontaine,项目名称:displaytag,代码行数:39,代码来源:Displ230.java
示例18: createHandler
import com.meterware.httpunit.HTMLElement; //导入依赖的package包/类
public ScriptingHandler createHandler( HTMLElement elementBase ) {
ScriptableDelegate delegate = elementBase.newScriptable();
delegate.setScriptEngine( elementBase.getParentDelegate().getScriptEngine( delegate ) );
return delegate;
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:6,代码来源:JavaScriptEngineFactory.java
示例19: createHandler
import com.meterware.httpunit.HTMLElement; //导入依赖的package包/类
public ScriptingHandler createHandler( HTMLElement elementBase ) {
return (ScriptingHandler) elementBase.getNode();
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:4,代码来源:DomBasedScriptingEngineFactory.java
示例20: testFormatSubnetZeros
import com.meterware.httpunit.HTMLElement; //导入依赖的package包/类
public void testFormatSubnetZeros() throws InstantiationException, IllegalAccessException,
ClassNotFoundException, SQLException, IOException, SAXException
{
TestUtils theTestUtils = new TestUtils();
WebResponse response = loadUrl (theTestUtils);
WebForm configurationForm = response.getFormWithID("config");
WebTable table = response.getTableWithID("TableLocalSubnets");
int oldNumSubnets = table.getRowCount() - SIZE_HEADS;
String newSubnet = "99.99.99.";
configurationForm.setParameter("newSubnet", newSubnet);
configurationForm.submit();
String newSubnet2 = "000.015.255.";
configurationForm.setParameter("newSubnet", newSubnet2);
response = configurationForm.submit();
HTMLElement result = response.getElementWithID("unsuccessResult");
String resultString = result.getNode().getFirstChild().getNextSibling().getFirstChild().getNodeValue();
assertEquals("Incorrect new subnet format. Please try again as follows: 0-255.0-255.0-255.", resultString);
theTestUtils = new TestUtils();
response = loadUrl (theTestUtils);
table = response.getTableWithID("TableLocalSubnets");
int numSubnets = table.getRowCount() - SIZE_HEADS;
assertTrue(numSubnets > oldNumSubnets);
assertEquals(newSubnet, table.getCellAsText((numSubnets),0));
//assertEquals(table., "0.15.255.");
WebRequest request = new GetMethodWebRequest(theTestUtils.getUrlPmgraph() + "configure.jsp?newSubnet=099.099.099.&numSubnets="+numSubnets);
response = m_conversation.getResponse(request);
result = response.getElementWithID("unsuccessResult");
resultString = result.getNode().getFirstChild().getNextSibling().getFirstChild().getNodeValue();
assertEquals("Incorrect new subnet format. Please try again as follows: 0-255.0-255.0-255.", resultString);
response = loadUrl (theTestUtils);
configurationForm = response.getFormWithID("config");
FormControl aux = configurationForm.getControlWithID("delSubnet"+numSubnets);
aux.toggle();
configurationForm.submit();
response = loadUrl (theTestUtils);
table = response.getTableWithID("TableLocalSubnets");
numSubnets = table.getRowCount() - SIZE_HEADS;
assertEquals(oldNumSubnets, numSubnets);
}
开发者ID:aptivate,项目名称:pmgraph,代码行数:44,代码来源:TestMultiSubnets.java
注:本文中的com.meterware.httpunit.HTMLElement类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论