Package com.gargoylesoftware.htmlunit.html

Examples of com.gargoylesoftware.htmlunit.html.HtmlDivision


        HtmlForm form = page.getHtmlElementById("modifyCardForm");
        form.getInputByName("name").setValueAttribute("");
        page = form.getInputByValue("Modify card").click();
        testTitle(page, "Modify a card");
        HtmlDivision cardsDiv = page.getHtmlElementById("cards");
        List<HtmlDivision> cardDivs = cardsDiv.getElementsByAttribute("div", "class", "card");
        assertEquals(3, cardDivs.size());

        // test that an error is triggered when checking the change password checkbox is checked and
        // the password is empty
        form = page.getHtmlElementById("modifyCardForm");
View Full Code Here


        form.getInputByName("name").setValueAttribute("card4");
        page = form.getInputByValue("Modify card").click();

        testTitle(page, "Cards");
        testMessageExists(page, "The card \"card4\" has been modified.");
        HtmlDivision cardsDiv = page.getHtmlElementById("cards");
        List<HtmlDivision> cardDivs = cardsDiv.getElementsByAttribute("div", "class", "card");
        assertEquals(3, cardDivs.size());
        assertTrue(cardsDiv.asText().contains("card4"));
        assertFalse(cardsDiv.asText().contains("card1"));
    }
View Full Code Here

    @Test
    public void testDetailsSection() throws Exception {
        WebClient wc = startWebClient();
        HtmlPage page = goToDetailsPage(wc);
        HtmlDivision detailsDiv = page.getHtmlElementById("cardDetails");
        String text = detailsDiv.asText();
        assertTrue(text.contains("card1"));
        assertTrue(text.contains("login1"));
        assertTrue(text.contains("password1"));
        assertTrue(text.contains("http://www.google.com"));
        assertTrue(text.contains("This is the note\r\nfor card1"));
View Full Code Here

    @Test
    public void testDetailsLinks() throws Exception {
        WebClient wc = startWebClient();
        HtmlPage page = goToDetailsPage(wc);
        HtmlDivision detailsDiv = page.getHtmlElementById("cardDetails");

        HtmlAnchor urlLink = getFirstLinkByText(detailsDiv, "http://www.google.com");
        HtmlPage urlPage = urlLink.click();
        assertTrue(urlPage.getTitleText().contains("Google"));
View Full Code Here

    @Test
    public void testDetailsLinksWithoutJavascript() throws Exception {
        WebClient wc = startWebClient();
        wc.setJavaScriptEnabled(false);
        HtmlPage page = goToDetailsPage(wc);
        HtmlDivision detailsDiv = page.getHtmlElementById("cardDetails");

        HtmlAnchor createLink = getFirstLinkByText(detailsDiv, "Create a new card");
        HtmlPage createPage = createLink.click();
        testTitle(createPage, "Create a card");
View Full Code Here

        form.getInputByName("login").type("login");
        form.getInputByName("password").type("password");
        form.getInputByValue("Create card").click();

        testMessageExists(page, "The card \"card4\" has been created");
        HtmlDivision cardsDiv = page.getHtmlElementById("cards");
        List<HtmlDivision> cardDivs = cardsDiv.getElementsByAttribute("div", "class", "card");
        assertEquals(4, cardDivs.size());
    }
View Full Code Here

        form.getInputByName("url").type("http://www.google.com");
        HtmlPage cardsPage = form.getInputByValue("Create card").click();

        testTitle(cardsPage, "Cards");
        testMessageExists(cardsPage, "The card \"card4\" has been created.");
        HtmlDivision cardsDiv = cardsPage.getHtmlElementById("cards");
        List<HtmlDivision> cardDivs = cardsDiv.getElementsByAttribute("div", "class", "card");
        assertEquals(4, cardDivs.size());
        HtmlAnchor card4DetailsLink = getFirstLinkByText(cardsDiv, "card4");
        // test that the icon in the link has been fetched
        assertTrue(card4DetailsLink.getElementsByTagName("img").get(0).asXml().contains("google"));
    }
View Full Code Here

    @Test
    public void testCardsList() throws Exception {
        WebClient wc = startWebClient();
        login(wc);
        HtmlPage page = wc.getPage(url("/cards/Cards.action"));
        HtmlDivision cardsDiv = page.getHtmlElementById("cards");
        List<HtmlDivision> cardDivs = cardsDiv.getElementsByAttribute("div", "class", "card");
        assertEquals(3, cardDivs.size());

        // test card icon when icon URL is not null
        HtmlDivision card1Div = cardDivs.get(0);
        assertEquals("card1", card1Div.asText());
        HtmlAnchor detailsLink = getFirstLinkByText(card1Div, "card1");
        HtmlImage cardIcon = (HtmlImage) detailsLink.getHtmlElementsByTagName("img").get(0);
        assertEquals("http://www.google.com/favicon.ico", cardIcon.getAttribute("src"));

        // test card icon when icon URL is null
        HtmlDivision card3Div = cardDivs.get(2);
        assertEquals("card3", card3Div.asText());
        detailsLink = getFirstLinkByText(card3Div, "card3");
        cardIcon = (HtmlImage) detailsLink.getHtmlElementsByTagName("img").get(0);
        assertEquals("/img/card.png", cardIcon.getAttribute("src"));
    }
View Full Code Here

    public void testCardLinksWithJavascript() throws Exception {
        WebClient wc = startWebClient();
        login(wc);
        HtmlPage page = wc.getPage(url("/cards/Cards.action"));

        HtmlDivision cardsDiv = page.getHtmlElementById("cards");
        List<HtmlDivision> cardDivs = cardsDiv.getElementsByAttribute("div", "class", "card");

        HtmlDivision card1Div = cardDivs.get(0);
        HtmlDivision card2Div = cardDivs.get(1);
        HtmlDivision card3Div = cardDivs.get(2);

        HtmlAnchor detailsLink = getFirstLinkByText(card1Div, "card1");

        detailsLink.click();
        testTitle(page, "Cards");
View Full Code Here

        WebClient wc = startWebClient();
        wc.setJavaScriptEnabled(false);
        login(wc);
        HtmlPage page = wc.getPage(url("/cards/Cards.action"));

        HtmlDivision cardsDiv = page.getHtmlElementById("cards");
        List<HtmlDivision> cardDivs = cardsDiv.getElementsByAttribute("div", "class", "card");

        HtmlDivision card1Div = cardDivs.get(0);
        HtmlDivision card2Div = cardDivs.get(1);
        HtmlDivision card3Div = cardDivs.get(2);

        HtmlAnchor detailsLink = getFirstLinkByText(card1Div, "card1");

        HtmlPage detailsPage = detailsLink.click();
        testTitle(detailsPage, "Card details");
View Full Code Here

TOP

Related Classes of com.gargoylesoftware.htmlunit.html.HtmlDivision

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.