当前位置: 首页>>代码示例>>Java>>正文


Java WebForm.submit方法代码示例

本文整理汇总了Java中com.meterware.httpunit.WebForm.submit方法的典型用法代码示例。如果您正苦于以下问题:Java WebForm.submit方法的具体用法?Java WebForm.submit怎么用?Java WebForm.submit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.meterware.httpunit.WebForm的用法示例。


在下文中一共展示了WebForm.submit方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testHiddenAttributes

import com.meterware.httpunit.WebForm; //导入方法依赖的package包/类
public void testHiddenAttributes () throws Exception {

  WebResponse resp = wc.getResponse(webedTestLocation
      + "/test/FieldTag/testHiddenAttributes.jsp");
  WebForm form = resp.getForms()[0];
  // The field is rendered as the last item in the frames DOM
  Node node = getLastElementChild(form.getDOMSubtree());
  
  checkType(node, "input");
  checkAttribute(node, "value", "VALUE");
  checkAttribute(node, "type", "hidden");
  checkCommonAttributes(node);
  
  //Submit the form to check that no problems occur
  form.submit();
  // Check for the correct forward
  assertEquals("Incorrect Result", webedTestApplication
      + "/test/defaultForward.html", wc.getCurrentPage().getURL().getPath());
  
}
 
开发者ID:ontopia,项目名称:ontopia,代码行数:21,代码来源:FieldTagTest.java

示例2: testPasswordAttributes

import com.meterware.httpunit.WebForm; //导入方法依赖的package包/类
public void testPasswordAttributes () throws Exception {
  
  WebResponse resp = wc.getResponse(webedTestLocation
      + "/test/FieldTag/testPasswordAttributes.jsp");
  WebForm form = resp.getForms()[0];
  // The field is rendered as the last item in the frames DOM
  Node node = getLastElementChild(form.getDOMSubtree());
  
  checkType(node, "input");
  checkAttribute(node, "value", "VALUE");
  checkAttribute(node, "type", "password");
  checkAttribute(node, "class", "input");
  checkAttribute(node, "maxlength", "75");
  checkAttribute(node, "size", "50");
  checkCommonAttributes(node);
  
  //Submit the form to check that no problems occur
  form.submit();
  // Check for the correct forward
  assertEquals("Incorrect Result", webedTestApplication
      + "/test/defaultForward.html", wc.getCurrentPage().getURL().getPath());
  
}
 
开发者ID:ontopia,项目名称:ontopia,代码行数:24,代码来源:FieldTagTest.java

示例3: testDropdownAttributesWithNone

import com.meterware.httpunit.WebForm; //导入方法依赖的package包/类
public void testDropdownAttributesWithNone () throws Exception {
  
  WebResponse resp = wc.getResponse(webedTestLocation
      + "/test/ListTag/testDropdownAttributesWithNone.jsp");
  WebForm form = resp.getForms()[0];
  Node node = getLastElementChild(form.getDOMSubtree());
  
  checkListAttributes(node, null, getKnownContents());
  
  //Submit the form to check that no problems occur
  form.submit();
  // Check for the correct forward
  assertEquals("Incorrect Result", webedTestApplication
      + "/test/defaultForward.html", wc.getCurrentPage().getURL().getPath());
  
}
 
开发者ID:ontopia,项目名称:ontopia,代码行数:17,代码来源:ListTagTest.java

示例4: testStateCheckedAttributes

import com.meterware.httpunit.WebForm; //导入方法依赖的package包/类
public void testStateCheckedAttributes () throws Exception {

  WebResponse resp = wc.getResponse(webedTestLocation
      + "/test/CheckboxTag/testStateCheckedAttributes.jsp");
  WebForm form = resp.getForms()[0];
  // The checkbox is rendered as the last item in the frames DOM
  Node checkbox = getLastElementChild(form.getDOMSubtree());
  
  checkAttribute(checkbox, "checked", "checked");
  checkCommonAttributes(checkbox);
  
  //Submit the form to check that no problems occur
  form.submit();
  // Check for the correct forward
  assertEquals("Incorrect Result", webedTestApplication
      + "/test/defaultForward.html", wc.getCurrentPage().getURL().getPath());
  
}
 
开发者ID:ontopia,项目名称:ontopia,代码行数:19,代码来源:CheckboxTagTest.java

示例5: testStateUnCheckedAttributes

import com.meterware.httpunit.WebForm; //导入方法依赖的package包/类
public void testStateUnCheckedAttributes () throws Exception {
  WebResponse resp = wc.getResponse(webedTestLocation
      + "/test/CheckboxTag/testStateUnCheckedAttributes.jsp");
  WebForm form = resp.getForms()[0];
  // The checkbox is rendered as the last item in the frames DOM
  Node checkbox = getLastElementChild(form.getDOMSubtree());
  
  checkCommonAttributes(checkbox);
  assertNull("Checked attribute found", checkbox.getAttributes().getNamedItem("checked"));
  
  //Submit the form to check that no problems occur
  form.submit();
  // Check for the correct forward
  assertEquals("Incorrect Result", webedTestApplication
      + "/test/defaultForward.html", wc.getCurrentPage().getURL().getPath());
}
 
开发者ID:ontopia,项目名称:ontopia,代码行数:17,代码来源:CheckboxTagTest.java

示例6: testTopicValueAttributes

import com.meterware.httpunit.WebForm; //导入方法依赖的package包/类
public void testTopicValueAttributes () throws Exception {  
  WebResponse resp = wc.getResponse(webedTestLocation
      + "/test/InvokeTag/testTopicValueAttributes.jsp");
  WebForm form = resp.getForms()[0];
  Node node = getLastElementChild(form.getDOMSubtree());
  
  // The "1" is the objectId of the TM object passed as the value.
  // Since we do not have access to the TM here, we must just do a 
  // hard coded check. 
  // NOTE: this value may change if the LTM parser changes.
  checkAttribute(node, "value", "1");
  checkCommonAttributes(node);
  
  //Submit the form to check that no problems occur
  form.submit();
  // Check for the correct forward
  assertEquals("Incorrect Result", webedTestApplication
      + "/test/defaultForward.html", wc.getCurrentPage().getURL().getPath());
  
}
 
开发者ID:ontopia,项目名称:ontopia,代码行数:21,代码来源:InvokeTagTest.java

示例7: testAttributes

import com.meterware.httpunit.WebForm; //导入方法依赖的package包/类
public void testAttributes () throws Exception {
  
  WebResponse resp = wc.getResponse(webedTestLocation
      + "/test/InvokeTag/testAttributes.jsp");
  WebForm form = resp.getForms()[0];
  Node node = getLastElementChild(form.getDOMSubtree());
  
  checkAttribute(node, "value", "no-value-given");
  checkCommonAttributes(node);
  
  //Submit the form to check that no problems occur
  form.submit();
  // Check for the correct forward
  assertEquals("Incorrect Result", webedTestApplication
      + "/test/defaultForward.html", wc.getCurrentPage().getURL().getPath());
    
}
 
开发者ID:ontopia,项目名称:ontopia,代码行数:18,代码来源:InvokeTagTest.java

示例8: testMultiselectAttributes

import com.meterware.httpunit.WebForm; //导入方法依赖的package包/类
public void testMultiselectAttributes () throws Exception {
  
  WebResponse resp = wc.getResponse(webedTestLocation
      + "/test/ListTag/testMultiselectAttributes.jsp");
  WebForm form = resp.getForms()[0];
  Node node = getLastElementChild(form.getDOMSubtree());
  
  checkMultiselectAttributes(node, "-- unspecified --");
  
  //Submit the form to check that no problems occur
  form.submit();
  // Check for the correct forward
  assertEquals("Incorrect Result", webedTestApplication
      + "/test/defaultForward.html", wc.getCurrentPage().getURL().getPath());
  
}
 
开发者ID:ontopia,项目名称:ontopia,代码行数:17,代码来源:ListTagTest.java

示例9: testReadonlyTrue

import com.meterware.httpunit.WebForm; //导入方法依赖的package包/类
public void testReadonlyTrue() throws Exception {
  // First remove topics that may give the test false positives.
  WebResponse resp = wc.getResponse(webedTestLocation
      + "/test/LinkTag/testLinkTagCleanup.jsp");
  WebForm form = resp.getForms()[0];
  form.submit();
  
  // Go to the test page.
  resp = wc.getResponse(webedTestLocation
      + "/test/LinkTag/testReadonlyTrue.jsp");
  // Make sure that no topics that could cause false positives exist.
  assertTrue("testLinkTag topic already exists before the test." , 
      wc.getCurrentPage().getText().indexOf("Topics: {}") >= 0);

  // Click the link.
  resp.getLinkWith("add topic with name \"testLinkTag\".").click();
  
  // Get the new page.
  resp = wc.getCurrentPage();
  // Check that one topic was created (and given name) as required.
  assertFalse("webed:link element ran action on readonly form.", 
      wc.getCurrentPage().getText().indexOf("Topics: {1}") >= 0);
}
 
开发者ID:ontopia,项目名称:ontopia,代码行数:24,代码来源:LinkTagTest.java

示例10: testDefaultAttributesWithNone

import com.meterware.httpunit.WebForm; //导入方法依赖的package包/类
public void testDefaultAttributesWithNone () throws Exception {
  
  WebResponse resp = wc.getResponse(webedTestLocation
      + "/test/ListTag/testDefaultAttributesWithNone.jsp");
  WebForm form = resp.getForms()[0];
  Node node = getLastElementChild(form.getDOMSubtree());
  
  checkListAttributes(node, null, getKnownContents());
  
  //Submit the form to check that no problems occur
  form.submit();
  // Check for the correct forward
  assertEquals("Incorrect Result", webedTestApplication
      + "/test/defaultForward.html", wc.getCurrentPage().getURL().getPath());
  
}
 
开发者ID:ontopia,项目名称:ontopia,代码行数:17,代码来源:ListTagTest.java

示例11: testSearchPage

import com.meterware.httpunit.WebForm; //导入方法依赖的package包/类
/** This method tests the search Page. It also submits a query for cats and 
 * verifies that the result has at least two items */
private void testSearchPage(WebConversation wc, WebResponse resp) throws Exception {
    // Test the search page
    WebLink wl = resp.getLinkWith("Search");
    wl.click();
    resp = wc.getCurrentPage();
    // check if the search returns more than one result for "cat
    WebForm form = resp.getForms()[0];
    assertEquals("on", form.getParameterValue("searchForm:searchTags"));
    String searchText = "cat";
    form.setParameter("searchForm:searchString", searchText);
    form.submit();
    resp = wc.getCurrentPage();
    WebTable resultTable = resp.getTableStartingWithPrefix("Map");
    assertTrue(resultTable.getRowCount() > 2);
}
 
开发者ID:sugar-lang,项目名称:case-studies,代码行数:18,代码来源:PetStoreWebBlackBoxTest.java

示例12: signUpPatient

import com.meterware.httpunit.WebForm; //导入方法依赖的package包/类
/**
 * Convenience method to drive a click through of the process of signing up a new patient.
 * @param patientConfig the specification of the patient to create
 * @return a User instance representing the new patient
 * @throws SAXException if there is an error parsing a page in the click-though sequence.
 * @throws IOException if there is an issue reading a page.
 */
public User signUpPatient(PatientConfig patientConfig) throws SAXException, IOException {
    setLoggedInUser(patientConfig.getEmail(), false);

    WebResponse landingPage = client.getResponse("http://localhost/");

    WebResponse signupPage = landingPage.getLinkWith("I am a patient").click();
    WebForm signupForm = signupPage.getForms()[0];
    signupForm.setParameter("name", patientConfig.getName());
    signupForm.setParameter("location", patientConfig.getAddress());
    signupForm.submit();

    observeRateLimit();

    return getUser();
}
 
开发者ID:openmash,项目名称:mashmesh,代码行数:23,代码来源:IntegrationTestHelper.java

示例13: testAddingPerson

import com.meterware.httpunit.WebForm; //导入方法依赖的package包/类
/**
 * Try to add one person and check that only this person is found.
 */
@Test
public void testAddingPerson() throws IOException, SAXException {
    // Call servlet
    request = new GetMethodWebRequest(serverUrl + "/persistence-with-jdbc/");
    response = wc.getResponse(request);

    // Fill out form and submit a person
    WebForm form = response.getForms()[0];
    form.setParameter("FirstName", "John_" + nameSupplement);
    form.setParameter("LastName", "Doe_" + nameSupplement);
    response = form.submit();
    Assert.assertThat(response.getText(), containsString("John_" + nameSupplement));
    Assert.assertThat(response.getText(), containsString("Doe_" + nameSupplement));
}
 
开发者ID:qianyilun,项目名称:Queue-Manager-Cloud-Dispatcher,代码行数:18,代码来源:PersistenceWithJDBCIntegrationTest.java

示例14: testDefaultForward

import com.meterware.httpunit.WebForm; //导入方法依赖的package包/类
public void testDefaultForward() throws Exception {
  WebResponse resp = wc.getResponse(webedTestLocation
      + "/test/General/testDefaultForward.jsp");
  WebForm form = resp.getForms()[0];
  resp = form.submit();
  assertEquals("Default Forward Failed", webedTestApplication
      + "/test/defaultForward.html", resp.getURL().getPath());
}
 
开发者ID:ontopia,项目名称:ontopia,代码行数:9,代码来源:GeneralActionTest.java

示例15: testAddSubnet

import com.meterware.httpunit.WebForm; //导入方法依赖的package包/类
public void testAddSubnet() throws InstantiationException, IllegalAccessException, 
           ClassNotFoundException, SQLException, IOException, SAXException
{		
	TestUtils theTestUtils = new TestUtils();
	WebRequest request = new GetMethodWebRequest(theTestUtils.getUrlPmgraph() + "configure.jsp");
	WebResponse response = m_conversation.getResponse(request);
	
	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();
	
	theTestUtils = new TestUtils();
	response = loadUrl (theTestUtils);
	table = response.getTableWithID("TableLocalSubnets");
	int numSubnets = table.getRowCount() - SIZE_HEADS;
	assertTrue(numSubnets > oldNumSubnets);
    	assertEquals(table.getCellAsText(numSubnets,0), newSubnet);
    	
    	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;
	assertTrue(numSubnets == oldNumSubnets);
}
 
开发者ID:aptivate,项目名称:pmgraph,代码行数:32,代码来源:TestMultiSubnets.java


注:本文中的com.meterware.httpunit.WebForm.submit方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。