Package com.gargoylesoftware.htmlunit.html

Examples of com.gargoylesoftware.htmlunit.html.HtmlTable$RowIterator


  }

  @Test
  public void testGallery() throws FailingHttpStatusCodeException, MalformedURLException, IOException, InterruptedException {
    final HtmlPage page = webClient.getPage("http://localhost:8080/photark/");
    final HtmlTable table = page.getHtmlElementById("tableGallery");
   
    //testing the static part of the gallery
    final String pageAsXml = page.asXml();
    assertTrue(pageAsXml.contains("<a href=\"javascript:displayGallery()\" onmouseover=\"document.index.src=index_on.src\" onmouseout=\"document.index.src=index_off.src\" onmousedown=\"beforeClick();\">"));
    assertTrue(pageAsXml.contains("<body onload=\"initGallery()\">"));
    final String pageAsText = page.asText();
    assertTrue(pageAsText.contains("Apache PhotArk Gallery"));
   
    Thread.sleep(3000);
    //testing the dynamic part of the gallery
   
    //albums loaded
    assertTrue( table.getRow(1).getCell(0).asText().contains("boston"));
    //Gallery pictures loaded
    assertTrue( table.getRow(3).getCell(0).asXml().contains("http://localhost:8080/photark/gallery/vegas/dsc00860.jpg"));
   
    //clicking on an image
    assertTrue(page.getElementById("albumImage").getAttribute("src").contains("space.gif"));
    DomNodeList<HtmlElement> ele= table.getRow(3).getCell(0).getElementsByTagName("a");
    final HtmlAnchor anchor =(HtmlAnchor) ele.get(0);
    final HtmlPage page2= anchor.click();
   
    Thread.sleep(3000);
    //checking whether there are images in the album
View Full Code Here


  }

  @Test
  public void testGallery() throws FailingHttpStatusCodeException, MalformedURLException, IOException, InterruptedException {
    final HtmlPage page = webClient.getPage("http://localhost:8080/photark/");
    final HtmlTable table = page.getHtmlElementById("tableGallery");
   
    //testing the static part of the gallery
    final String pageAsXml = page.asXml();
    assertTrue(pageAsXml.contains("<a href=\"javascript:displayGallery()\" onmouseover=\"document.index.src=index_on.src\" onmouseout=\"document.index.src=index_off.src\" onmousedown=\"beforeClick();\">"));
    assertTrue(pageAsXml.contains("<body onload=\"initGallery()\">"));
    final String pageAsText = page.asText();
    assertTrue(pageAsText.contains("Apache PhotArk Gallery"));
   
    Thread.sleep(3000);
    //testing the dynamic part of the gallery
   
    //albums loaded
    assertTrue( table.getRow(1).getCell(0).asText().contains("boston"));
    //Gallery pictures loaded
    assertTrue( table.getRow(3).getCell(0).asXml().contains("http://localhost:8080/photark/gallery/vegas/dsc00860.jpg"));
   
    //clicking on an image
    assertTrue(page.getElementById("albumImage").getAttribute("src").contains("space.gif"));
    DomNodeList<HtmlElement> ele= table.getRow(3).getCell(0).getElementsByTagName("a");
    final HtmlAnchor anchor =(HtmlAnchor) ele.get(0);
    final HtmlPage page2= anchor.click();
    Thread.sleep(3000);
    //checking whether there are images in the album
    assertTrue( page2.getElementById("albumImage").getAttribute("src").contains("/photark/gallery/vegas/dsc00860.jpg"));
View Full Code Here

  }

  @Test
  public void testGallery() throws FailingHttpStatusCodeException, MalformedURLException, IOException, InterruptedException {
    final HtmlPage page = webClient.getPage("http://localhost:8080/photark/");
    final HtmlTable table = page.getHtmlElementById("tableGallery");
   
    //testing the static part of the gallery
    final String pageAsXml = page.asXml();
    assertTrue(pageAsXml.contains("<a href=\"javascript:displayGallery()\" onmouseover=\"document.index.src=index_on.src\" onmouseout=\"document.index.src=index_off.src\" onmousedown=\"beforeClick();\">"));
    assertTrue(pageAsXml.contains("<body onload=\"initGallery()\">"));
    final String pageAsText = page.asText();
    assertTrue(pageAsText.contains("Apache PhotArk Gallery"));
   
    Thread.sleep(3000);
    //testing the dynamic part of the gallery
   
    //albums loaded
    assertTrue( table.getRow(1).getCell(0).asText().contains("boston"));
    //Gallery pictures loaded
    assertTrue( table.getRow(3).getCell(0).asXml().contains("http://localhost:8080/photark/gallery/vegas/dsc00860.jpg"));
   
    //clicking on an image
    assertTrue(page.getElementById("albumImage").getAttribute("src").contains("space.gif"));
    DomNodeList<HtmlElement> ele= table.getRow(3).getCell(0).getElementsByTagName("a");
    final HtmlAnchor anchor =(HtmlAnchor) ele.get(0);
    final HtmlPage page2= anchor.click();
    Thread.sleep(3000);
    //checking whether there are images in the album
    assertTrue( page2.getElementById("albumImage").getAttribute("src").contains("/photark/gallery/vegas/dsc00860.jpg"));
View Full Code Here

        assertEquals( "Project", img.getAttribute( "alt" ) );

        // test object identity to distinguish the case ATTRIBUTE_VALUE_EMPTY
        assertTrue( img.getAttribute( "dummy" ) == HtmlElement.ATTRIBUTE_NOT_DEFINED );

        HtmlTable table = (HtmlTable) elementIterator.next();
        assertEquals( "1", table.getAttribute( "border" ) );
        assertEquals( "none", table.getAttribute( "class" ) );

        element = elementIterator.next();
        // this is a htmlunit bug
        assertEquals( "tbody", element.getTagName() );
View Full Code Here

     * @return the index of the row within the parent table
     * @see <a href="http://msdn.microsoft.com/en-us/library/ms534377.aspx">MSDN Documentation</a>
     */
    public int jsxGet_rowIndex() {
        final HtmlTableRow row = (HtmlTableRow) getDomNodeOrDie();
        final HtmlTable table = row.getEnclosingTable();
        if (table == null) { // a not attached document.createElement('TR')
            return -1;
        }
        return table.getRows().indexOf(row);
    }
View Full Code Here

     * @see <a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-one-html.html#ID-79105901">
     * DOM Level 1</a>
     */
    public int jsxGet_sectionRowIndex() {
        DomNode row = getDomNodeOrDie();
        final HtmlTable table = ((HtmlTableRow) row).getEnclosingTable();
        if (table == null) { // a not attached document.createElement('TR')
            if (!getBrowserVersion().isIE()) {
                return -1;
            }
            // IE 6, 7 and 8 return really strange values: large integers that are not constants
View Full Code Here

      //client.getElement("historyDetailsPanel_body");
      HtmlDivision resultsDiv = (HtmlDivision) client.getElement("operationResults");
      if( null == resultsDiv )
        throw new HtmlElementNotFoundException("#operationResults - a div around a results table.");

      HtmlTable resultsTableElm = resultsDiv.getFirstByXPath(".//table[@class='properties-table']");
      if( null == resultsTableElm )
        throw new HtmlElementNotFoundException(".//table[@class='properties-table'] - a results table.");
      ContentTable resultsTable = ejtt.getTabMenu().getTabContentBox().getTable(resultsTableElm);
     
      // Process the results table.
View Full Code Here

      ejtt.tabMenu.getTabContentBox().getButtonInputByLabel(EXECUTE_OP_NAME).click();

      // Command Line Arguments:  "-c"
      // No tab content box in this block.
      {
        HtmlTable resultsTableElm = ((HtmlForm)client.getElement("parametersForm")).getFirstByXPath(".//table[@class='properties-table']");
        ContentTable resultsTable = ejtt.getTable(resultsTableElm);

        ContentTableRow row = resultsTable.getFirstRowContainingText("Command Line Arguments");
        assertNotNull("'Command Line Arguments' row not found.", row);
        HtmlCheckBoxInput unsetCheckbox = row./*getCellByColumnName("Unset").*/ getElement().getFirstByXPath(".//input[@type='checkbox']");
        unsetCheckbox.setChecked(false);
        HtmlTextArea argsTA = row./*getCellByColumnName("Value").*/ getElement().getFirstByXPath(".//textarea"); // [@ondblclick='commandLineArguments']
        argsTA.setText("-c");
        DebugUtils.writeFile("target/scriptsWithParam-settingParams.html", client.getPageAsText());

        ejtt.sleep(2000);

        // Run.
        ((HtmlSubmitInput) client.getElement("parametersForm:okButton")).click();
      }


      // Wait for the operation to succesfuly finish.
      ejtt.operations.waitActivelyForOperationToFinish(EXECUTE_OP_NAME, 5000, 5);
      assertTrue(EXECUTE_OP_NAME+" operation wasn't successful.", ejtt.tabMenu.getTabContentBox().getOperationsHistoryTable().wasLastOperationSuccesful() );

      ejtt.sleep(2000);

      // Get the results table.
      //client.getElement("historyDetailsPanel_body");
      HtmlDivision resultsDiv = (HtmlDivision) client.getElement("operationResults");
      if( null == resultsDiv )
        throw new HtmlElementNotFoundException("#operationResults - a div around a results table.");

      HtmlTable resultsTableElm = resultsDiv.getFirstByXPath(".//table[@class='properties-table']");
      if( null == resultsTableElm )
        throw new HtmlElementNotFoundException(".//table[@class='properties-table'] - a results table.");
      ContentTable resultsTable = ejtt.getTabMenu().getTabContentBox().getTable(resultsTableElm);

      // Process the results table.
View Full Code Here

            @Override
            public boolean isPresent(HtmlPage page) {
                return page.getFirstByXPath("//table") != null;
            }
        });
        HtmlTable table = taskOverviewPage.getFirstByXPath("//table");
        assertNotNull("Table on Overviewpage not found", table);
        assertEquals("Not all tasks found on page", 4, table.getRowCount());
        HtmlTableRow headerRow = table.getRow(0);
        assertTrue(headerRow.asText().contains("TaskId"));
        HtmlTableRow actionsRow = table.getRow(1);
        assertTrue(actionsRow.asText().contains("filter clear"));
        HtmlTableRow taskOneRow = table.getRow(2);
        assertTrue(taskOneRow.asText().contains("step1"));
        assertEquals("even", taskOneRow.getAttribute("class"));
        HtmlTableRow taskTwoRow = table.getRow(3);
        assertTrue(taskTwoRow.asText().contains("step1"));
        assertEquals("odd", taskTwoRow.getAttribute("class"));
        String rowTwoText = taskTwoRow.asText();

        taskOverviewPage = taskOneRow.getCell(0).getHtmlElementsByTagName("a").get(0).click();
//        System.out.println(taskOverviewPage.asXml());
        waitForTextOnPage(taskOverviewPage, new ElementCondition() {
            @Override
            public boolean isPresent(HtmlPage page) {
                return page.getForms().size() == 2;
            }
        });
        HtmlForm detailForm = taskOverviewPage.getForms().get(1);
        HtmlSubmitInput finishButton = (HtmlSubmitInput) detailForm.getByXPath("input[@type=\"submit\"]").get(0);
        detailForm.getInputByName("taskname").setValueAttribute("taskname");
        detailForm.getTextAreaByName("taskdescription").setText("taskdescription");
        taskOverviewPage = finishButton.click();

        boolean isRight = false;
        for (int i = 0; i < MAX_RETRY && !isRight; i++) {
            try {
                taskOverviewPage = webClient.getPage(pageEntryUrl);
                table = taskOverviewPage.getFirstByXPath("//table");
                taskOneRow = table.getRow(2);
                taskTwoRow = table.getRow(3);
                isRight =
                    taskOneRow.asText().contains("step2") && taskOneRow.asText().contains("taskdescription")
                            && taskTwoRow.asText().contains("step1") && table.getRowCount() == 4;
                if (!isRight) {
                    Thread.sleep(3000);
                }
            } catch (Exception ex) {

            }
        }
        if (!isRight) {
            fail("Could not process click event in time!");
        }

        assertEquals("The taskbox should contain 2 tasks", 2, taskboxService.getOpenTasks().size());
        taskOneRow.getCell(0).getHtmlElementsByTagName("a").get(0).click();
        taskOneRow.getCell(0).getHtmlElementsByTagName("a").get(0).click();
        waitForTextOnPage(taskOverviewPage, new ElementCondition() {
            @Override
            public boolean isPresent(HtmlPage page) {
                return page.getForms().size() == 2;
            }
        });
        detailForm = taskOverviewPage.getForms().get(1);
        assertEquals("The taskname column is missing", "taskname", detailForm.getInputByName("taskname")
            .getValueAttribute());
        assertEquals("The taskdescription column is missing", "taskdescription",
            detailForm.getTextAreaByName("taskdescription").getText());
        finishButton = (HtmlSubmitInput) detailForm.getByXPath("input[@type=\"submit\"]").get(0);
        taskOverviewPage = finishButton.click();

        isRight = false;
        for (int i = 0; i < MAX_RETRY && !isRight; i++) {
            try {
                taskOverviewPage = webClient.getPage(pageEntryUrl);
                table = taskOverviewPage.getFirstByXPath("//table");
                taskOneRow = table.getRow(2);
                isRight =
                    taskOneRow.asText().contains("step1") && table.getRowCount() == 3;
                if (!isRight) {
                    Thread.sleep(3000);
                }
            } catch (Exception ex) {
View Full Code Here

        taskboxService.registerTaskPanel("step1", TestTaskPanel.class);
        workflowService.startFlow(WORKFLOW);

        HtmlPage taskOverviewPage = webClient.getPage(pageEntryUrl);
        taskOverviewPage = taskOverviewPage.getAnchorByText("Task-Overview").click();
        HtmlTable table = taskOverviewPage.getFirstByXPath("//table");
        assertNotNull("Table on Overviewpage not found", table);

        HtmlTableRow taskOneRow = table.getRow(2);
        taskOverviewPage = taskOneRow.getCell(0).getHtmlElementsByTagName("a").get(0).click();

        waitForTextOnPage(taskOverviewPage, new ElementCondition() {
            @Override
            public boolean isPresent(HtmlPage page) {
View Full Code Here

TOP

Related Classes of com.gargoylesoftware.htmlunit.html.HtmlTable$RowIterator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.