Package com.gargoylesoftware.htmlunit.html

Examples of com.gargoylesoftware.htmlunit.html.HtmlAnchor


        final HtmlPage page = (HtmlPage) _webClient.getPage(_url);
        FrameWindow menuFrame = page.getFrameByName("fixed");
        HtmlPage menuPage = (HtmlPage)menuFrame.getEnclosedPage();

        //basic content
        HtmlAnchor commandAnchor = menuPage.getAnchorByHref("./indexCommand.jsp");
        HtmlPage commandPage = (HtmlPage)commandAnchor.click();
        String commandText = commandPage.asText();
        //System.out.println("command html-->\n" + commandText);
        assertTrue(-1 != commandText.indexOf("DAS Command:"));//heading
        assertTrue(-1 != commandText.indexOf("ExecuteCommand"));//button text
View Full Code Here


        final HtmlPage page = (HtmlPage) _webClient.getPage(_url);
        FrameWindow menuFrame = page.getFrameByName("fixed");
        HtmlPage menuPage = (HtmlPage)menuFrame.getEnclosedPage();

        //basic content
        HtmlAnchor adhocAnchor = menuPage.getAnchorByHref("./indexAdhoc.jsp");
        HtmlPage adhocPage = (HtmlPage)adhocAnchor.click();
        String adhocText = adhocPage.asText();
        //System.out.println("adhoc html-->\n" + adhocText);
        assertTrue(-1 != adhocText.indexOf("Adhoc SQL Query"));//heading
        assertTrue(-1 != adhocText.indexOf("ExecuteQuery"));//button text
View Full Code Here

        final HtmlPage page = (HtmlPage) _webClient.getPage(_url);
        FrameWindow menuFrame = page.getFrameByName("fixed");
        HtmlPage menuPage = (HtmlPage)menuFrame.getEnclosedPage();

        //basic content
        HtmlAnchor commandAnchor = menuPage.getAnchorByHref("./indexCommand.jsp");
        HtmlPage commandPage = (HtmlPage)commandAnchor.click();
        String commandText = commandPage.asText();
        //System.out.println("command html-->\n" + commandText);
        assertTrue(-1 != commandText.indexOf("DAS Command:"));//heading
        assertTrue(-1 != commandText.indexOf("ExecuteCommand"));//button text
View Full Code Here

        final HtmlPage page = (HtmlPage) _webClient.getPage(_url);
        FrameWindow menuFrame = page.getFrameByName("fixed");
        HtmlPage menuPage = (HtmlPage)menuFrame.getEnclosedPage();

        //basic content
        HtmlAnchor commandAnchor = menuPage.getAnchorByHref("./occ.jsp");
        HtmlPage commandPage = (HtmlPage)commandAnchor.click();
        String commandText = commandPage.asText();
        //System.out.println("command html-->\n" + commandText);
        assertTrue(-1 != commandText.indexOf("Automatic Optimistic Concurrency Control:"));//heading
        assertTrue(-1 != commandText.indexOf("ExecuteTransaction"));//button text
View Full Code Here

        final HtmlPage page = (HtmlPage) _webClient.getPage(_url);
        FrameWindow menuFrame = page.getFrameByName("fixed");
        HtmlPage menuPage = (HtmlPage)menuFrame.getEnclosedPage();

        //basic content
        HtmlAnchor commandAnchor = menuPage.getAnchorByHref("./rss.jsp");
        HtmlPage commandPage = (HtmlPage)commandAnchor.click();
        String commandText = commandPage.asText();
        //System.out.println("command html-->\n" + commandText);
        assertTrue(-1 != commandText.indexOf("Result Set Shape:"));//heading
        assertTrue(-1 != commandText.indexOf("ExecuteQuery"));//button text
View Full Code Here

        final HtmlPage page = (HtmlPage) _webClient.getPage(_url);
        FrameWindow menuFrame = page.getFrameByName("fixed");
        HtmlPage menuPage = (HtmlPage)menuFrame.getEnclosedPage();

        //basic content
        HtmlAnchor commandAnchor = menuPage.getAnchorByHref("./converter.jsp");
        HtmlPage commandPage = (HtmlPage)commandAnchor.click();
        String commandText = commandPage.asText();
        //System.out.println("command html-->\n" + commandText);
        assertTrue(-1 != commandText.indexOf("Arbitrary Converter:"));//heading
        assertTrue(-1 != commandText.indexOf("ExecuteTransaction"));//button text
View Full Code Here

        final WebClient webClient = new WebClient();
        webClient.setJavaScriptEnabled( true );
        final HtmlPage page = webClient.getPage( uri.toURL() );

        final HtmlAnchor a =
            (HtmlAnchor) page.getByXPath( "//a[@href = \"javascript:toggleDisplay('surefire260.TestB.testDup');\"]" ).get( 0 );
        final HtmlDivision content = (HtmlDivision) page.getElementById( "surefire260.TestB.testDuperror" );
        assertTrue( content.getAttribute( "style" ).contains( "none" ) );
        a.click();
        assertFalse( content.getAttribute( "style" ).contains( "none" ) );
        webClient.closeAllWindows();
    }
View Full Code Here

    }
   
    @Test
    public void testLoginRedirectToUrl() throws FailingHttpStatusCodeException, IOException {
        HtmlPage pageWithLogoutLink = getWebClient().getPage(appEndpoint + "/page_with_logout_link.html");
        HtmlAnchor logoutLink = pageWithLogoutLink.getAnchorByText("logout");
        HtmlPage redirectPage = logoutLink.click();
        Assert.assertEquals(redirectPage.getTitleText(), "Logout success");
        Assert.assertEquals(redirectPage.getUrl().toString(), appEndpoint + "/logout_success.html");
    }
View Full Code Here

    }
   
    @Test
    public void testLoginRedirectToUrl() throws FailingHttpStatusCodeException, IOException {
        HtmlPage pageWithLoginLink = getWebClient().getPage(appEndpoint + "/page_with_login_link.html");
        HtmlAnchor loginLink = pageWithLoginLink.getAnchorByText("login");
        HtmlPage loginPage = loginLink.click();
        HtmlPage redirectPage = fillOutCredentialsAndLogin(loginPage);
        Assert.assertEquals(redirectPage.getTitleText(), "Page with login link");
        Assert.assertEquals(redirectPage.getUrl().toString(), appEndpoint + "/page_with_login_link.html");
    }
View Full Code Here

        if (alertLine == null) {
            assertThat(branchCell.asText(), equalTo(" "));
            assertThat(branchCell.getAttribute("class"), equalTo("numeric "+cssClass));
        } else {
            assertThat(branchCell.asText(), equalTo("info"));
            HtmlAnchor anchor = (HtmlAnchor) branchCell.getFirstChild().getFirstChild();

            final String alert[] = new String[1];
            webClient.setAlertHandler(new AlertHandler() {
                public void handleAlert(Page page, String message) {
                    alert[0] = message;
                }
            });

            anchor.click();
            assertThat(alert[0], containsString(alertLine));
        }
    }
View Full Code Here

TOP

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

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.