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/dsc00")); //Don't use a specific image
        //as we can get <> order in <> OS

        //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/dsc00")); //Don't use a specific image
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/dsc00")); //Don't use a specific image
        //as we can get <> order in <> OS

        //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/dsc00")); //Don't use a specific image
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/dsc00")); //Don't use a specific image
        //as we can get <> order in <> OS

        //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

            }
            if (!(htmlElement instanceof HtmlTable)) {
                throw new StepFailedException("Found '" + htmlElement.getTagName() +
                        "' element when looking for 'table' element using htmlId " + getHtmlId(), step);
            }
            final HtmlTable table = (HtmlTable) htmlElement;
            return table.getRow(getRow()).getCell(getColumn()).asText();
        }
        catch (final ElementNotFoundException e) {
            throw new TableNotFoundException(getHtmlId());
        }
    }
View Full Code Here

    @Test
    public void testTable() throws Exception {
        WebClient wc = startWebClient();
        login(wc);
        HtmlPage page = wc.getPage(url("/loginhistory/LoginHistory.action"));
        HtmlTable table = page.getHtmlElementById("loginHistoryTable");
        // first login: only one data row in the table
        assertEquals(2, table.getRowCount());
        assertTrue(table.getRow(1).getCell(0).asText().startsWith("Current session"));

        wc = startWebClient();
        login(wc);
        page = wc.getPage(url("/loginhistory/LoginHistory.action"));
        table = page.getHtmlElementById("loginHistoryTable");
        // second login: two data rows in the table
        assertEquals(3, table.getRowCount());
        assertTrue(table.getRow(1).getCell(0).asText().startsWith("Current session"));
    }
View Full Code Here

     * @throws SAXException if so.
     */
    private void doTestSearch(WebClient web, String searchString, int expectedCount) throws IOException, SAXException {
        HtmlPage htmlPage = web.goTo("/metadata-search/searchMetadata?metadata.search.queryString=" + searchString);
        HtmlElement documentElement = htmlPage.getDocumentElement();
        HtmlTable element = (HtmlTable)documentElement.getElementById("projectstatus");
        assertEquals(expectedCount + 1, element.getRowCount()); //One extra for the table header.
    }
View Full Code Here

        verifyTotal(webClient, page, 15);

        page.getAnchorByText("/example/script.js").click();
        webClient.waitForBackgroundJavaScript(2000);
        HtmlTable sourceTable = (HtmlTable)page.getElementById("sourceTable");
        verifySource(sourceTable, 11, 0, "else if (element.id === 'radio2') {");
        verifySource(sourceTable, 12, 0, "message = getMessage(2);");

        frame.getHtmlElementById("radio2").click();
        webClient.waitForBackgroundJavaScript(500);
View Full Code Here

        verifyTotal(webClient, page, 15);

        page.getAnchorByText("/example/script.js").click();
        webClient.waitForBackgroundJavaScript(2000);
        HtmlTable sourceTable = (HtmlTable)page.getElementById("sourceTable");
        verifySource(sourceTable, 11, 0, "else if (element.id === 'radio2') {", "Condition never evaluated         :\telement.id === 'radio2'", "r");
        verifySource(sourceTable, 12, 0, "message = getMessage(2);", null, "");

        frame.getHtmlElementById("radio2").click();
        webClient.waitForBackgroundJavaScript(500);
View Full Code Here

        HtmlPage page = getPage("/faces/standard/dtablerowclasses.jsp");
        assertNotNull(page);
        List<HtmlTable> tableList = new ArrayList<HtmlTable>(1);
        getAllElementsOfGivenClass(page, tableList, HtmlTable.class);
        assertTrue(tableList.size() == 1);
        HtmlTable table = tableList.get(0);
        List<HtmlTableRow> rows = table.getRows();
        assertTrue(rows.size() == 6);
        for (int i = 0, len = rows.size(); i < len; i++) {
            HtmlTableRow row = rows.get(i);
            if (i % 2 == 0) {
                assertTrue(row.getClassAttribute().equals("b1"));
View Full Code Here

   
    Iterator allHtmlChildElements = htmlElementsByTagName.iterator();
    int counter = 0;
   
    while (allHtmlChildElements.hasNext()) {
      HtmlTable table = (HtmlTable) allHtmlChildElements.next();
      HtmlTableCell handleCell = (HtmlTableCell) table.getCellAt(0, 0);
      HtmlTableCell iconCell = (HtmlTableCell) table.getCellAt(0, 1);
      HtmlTableCell textCell = (HtmlTableCell) table.getCellAt(0, 2);
     
      Element element = (Element) findNode(textCell.asText(), document);
      //skip text siblings
      Node nextSibling = element.getNextSibling();
     
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.