Package ghostdriver.server

Examples of ghostdriver.server.HttpRequestCallback


        assertEquals("The Title of The Item", d.findElement(By.className("item")).findElement(By.className("item-title")).getText());
    }

    @Test(expected = InvalidElementStateException.class)
    public void throwExceptionWhenInteractingWithInvisibleElement() {
        server.setHttpHandler("GET", new HttpRequestCallback() {
            @Override
            public void call(HttpServletRequest req, HttpServletResponse res) throws IOException {
                res.getOutputStream().println("<!DOCTYPE html>" +
                        "<html>" +
                        "    <head>\n" +
View Full Code Here


        BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(
            new FileOutputStream(testFile.getAbsolutePath()), "utf-8"));
        writer.write(FILE_HTML);
        writer.close();

        server.setHttpHandler("POST", new HttpRequestCallback() {
            @Override
            public void call(HttpServletRequest req, HttpServletResponse res) throws IOException {
                if (ServletFileUpload.isMultipartContent(req) && req.getPathInfo().endsWith("/upload")) {
                    // Create a factory for disk-based file items
                    DiskFileItemFactory factory = new DiskFileItemFactory(1024, new File(System.getProperty("java.io.tmpdir")));
View Full Code Here

        assertFalse(whandle.isEmpty());
    }

    @Test
    public void openPopupAndGetCurrentUrl() throws InterruptedException {
        server.setHttpHandler("GET", new HttpRequestCallback() {
            @Override
            public void call(HttpServletRequest req, HttpServletResponse res) throws IOException {
                res.getOutputStream().println("<html>" +
                        "<head>" +
                        "<script language=\"javascript\" type=\"text/javascript\">\n" +
View Full Code Here

    @Test
    public void shouldBeAbleToClickAndEventsBubbleUpUsingJquery() {
        final String buttonId = "clickme";

        server.setHttpHandler("GET", new HttpRequestCallback() {
            @Override
            public void call(HttpServletRequest req, HttpServletResponse res) throws IOException {
                res.getOutputStream().println(
                        "<html>\n" +
                                "<head>\n" +
View Full Code Here

        assertTrue(conditionMet);
    }

    @Test
    public void shouldWaitForOnClickCallbackToFinishBeforeContinuing() {
        server.setHttpHandler("GET", new HttpRequestCallback() {
            @Override
            public void call(HttpServletRequest req, HttpServletResponse res) throws IOException {
                res.getOutputStream().println("<script type=\"text/javascript\">\n" +
                        "    function sleep(milliseconds) {\n" +
                        "          var start = new Date().getTime();\n" +
View Full Code Here

        assertTrue(d.getTitle().toLowerCase().contains("google"));
    }

    @Test
    public void shouldNotHandleCasesWhenAsyncJavascriptInitiatesAPageLoadFarInTheFuture() {
        server.setHttpHandler("GET", new HttpRequestCallback() {
            @Override
            public void call(HttpServletRequest req, HttpServletResponse res) throws IOException {
                res.getOutputStream().println("<script type=\"text/javascript\">\n" +
                        "    function myFunction() {\n" +
                        "        setTimeout(function() {\n" +
View Full Code Here

    @Test
    public void shouldHandleCasesWhereJavascriptCodeInitiatesPageLoadsThatFail() throws InterruptedException {
        final String crazyUrl = "http://abcdefghilmnopqrstuvz.zvutsr";

        server.setHttpHandler("GET", new HttpRequestCallback() {
            @Override
            public void call(HttpServletRequest req, HttpServletResponse res) throws IOException {
                res.getOutputStream().println("<script type=\"text/javascript\">\n" +
                        "    function myFunction() {\n" +
                        "        window.location.href = \"" + crazyUrl + "\";\n" +
View Full Code Here

        BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(
            new FileOutputStream(testFile.getAbsolutePath()), "utf-8"));
        writer.write(FILE_HTML);
        writer.close();

        server.setHttpHandler("POST", new HttpRequestCallback() {
            @Override
            public void call(HttpServletRequest req, HttpServletResponse res) throws IOException {
                if (ServletFileUpload.isMultipartContent(req) && req.getPathInfo().endsWith("/upload")) {
                    // Create a factory for disk-based file items
                    DiskFileItemFactory factory = new DiskFileItemFactory(1024, new File(System.getProperty("java.io.tmpdir")));
View Full Code Here

TOP

Related Classes of ghostdriver.server.HttpRequestCallback

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.