Package org.openqa.selenium

Examples of org.openqa.selenium.JavascriptExecutor.executeScript()


    //
    private void scrollTable(TableElement tbl, int value) {
        WebElement actualElement = tbl.findElement(By
                .className("v-table-body-wrapper"));
        JavascriptExecutor js = tbl.getCommandExecutor();
        js.executeScript("arguments[0].scrollTop = " + value, actualElement);
    }
}
View Full Code Here


    private void scrollUp() {
        WebElement actualElement = getDriver().findElement(
                By.className("v-table-body-wrapper"));
        JavascriptExecutor js = new TestBenchCommandExecutor(getDriver(),
                new ImageComparison(), new ReferenceNameGenerator());
        js.executeScript("arguments[0].scrollTop = " + 30, actualElement);
    }

    private String getCurrentPageFirstItemIndex() throws InterruptedException {
        ButtonElement updateLabelButton = $(ButtonElement.class).get(4);
        LabelElement label = $(LabelElement.class).get(1);
View Full Code Here

                getMeasuredSizesMapSize());
    }

    private int getMeasuredSizesMapSize() {
        JavascriptExecutor jsExec = (JavascriptExecutor) getDriver();
        Number result = (Number) jsExec
                .executeScript("return window.vaadin.getMeasuredSizesCount();");
        return result.intValue();
    }

    @Override
View Full Code Here

    public void testStelenessAndJavascriptOnWebDriver() {
        WebElement stale = browser.findElement(By.className("stale"));
        makeStale.click();
        JavascriptExecutor executor = (JavascriptExecutor) browser;
        installator.install();
        executor.executeScript("Graphene.jQuery(arguments[0]).trigger('blur')", stale);
    }

    @Test
    public void testStelenessAndJavascriptOnWebElement() {
        WebElement inStale = browser.findElement(By.className("stale")).findElement(By.className("in-stale"));
View Full Code Here

    public void testStelenessAndJavascriptOnWebElement() {
        WebElement inStale = browser.findElement(By.className("stale")).findElement(By.className("in-stale"));
        makeStale.click();
        JavascriptExecutor executor = (JavascriptExecutor) browser;
        installator.install();
        executor.executeScript("Graphene.jQuery(arguments[0]).trigger('blur')", inStale);
    }

    @Test
    public void testStalenessAndActionsOnWebDriver1() {
        WebElement stale = browser.findElement(By.className("stale"));
View Full Code Here

    }

    public static Document getDocument(WebDriver browser) throws SAXException, IOException, ParserConfigurationException {
        final JavascriptExecutor executor = (JavascriptExecutor) browser;

        String responseText = (String) executor.executeScript("return __response");

        DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
        DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
        return dBuilder.parse(new ByteArrayInputStream(responseText.getBytes()));
    }
View Full Code Here

    }

    public static Document getDocument(WebDriver browser) throws SAXException, IOException, ParserConfigurationException {
        final JavascriptExecutor executor = (JavascriptExecutor) browser;

        String responseText = (String) executor.executeScript("return __response");

        DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
        DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
        return dBuilder.parse(new ByteArrayInputStream(responseText.getBytes()));
    }
View Full Code Here

        if (runInPortalEnv) {
            webDriver.get(String.format("%s://%s:%s/%s", contextRoot.getProtocol(), contextRoot.getHost(),
                contextRoot.getPort(), "portal/classic/showcase"));
            JavascriptExecutor js = (JavascriptExecutor) webDriver;
            String setTextQuery = "document.querySelector(\"input[id$='portalForm:%s']\").value = '%s';";
            js.executeScript(String.format(setTextQuery, "seleniumTestDemo", getDemoName()));
            js.executeScript(String.format(setTextQuery, "seleniumTestSample", getSampleName()));
            js.executeScript("document.querySelector(\"a[id$='portalForm:redirectToPortlet']\").click()");
        } else {
            if (layout == ShowcaseLayout.MOBILE) {
                webDriver.get(this.contextRoot.toExternalForm() + "mobile/"); // because of '#' in URLs
View Full Code Here

            webDriver.get(String.format("%s://%s:%s/%s", contextRoot.getProtocol(), contextRoot.getHost(),
                contextRoot.getPort(), "portal/classic/showcase"));
            JavascriptExecutor js = (JavascriptExecutor) webDriver;
            String setTextQuery = "document.querySelector(\"input[id$='portalForm:%s']\").value = '%s';";
            js.executeScript(String.format(setTextQuery, "seleniumTestDemo", getDemoName()));
            js.executeScript(String.format(setTextQuery, "seleniumTestSample", getSampleName()));
            js.executeScript("document.querySelector(\"a[id$='portalForm:redirectToPortlet']\").click()");
        } else {
            if (layout == ShowcaseLayout.MOBILE) {
                webDriver.get(this.contextRoot.toExternalForm() + "mobile/"); // because of '#' in URLs
            }
View Full Code Here

                contextRoot.getPort(), "portal/classic/showcase"));
            JavascriptExecutor js = (JavascriptExecutor) webDriver;
            String setTextQuery = "document.querySelector(\"input[id$='portalForm:%s']\").value = '%s';";
            js.executeScript(String.format(setTextQuery, "seleniumTestDemo", getDemoName()));
            js.executeScript(String.format(setTextQuery, "seleniumTestSample", getSampleName()));
            js.executeScript("document.querySelector(\"a[id$='portalForm:redirectToPortlet']\").click()");
        } else {
            if (layout == ShowcaseLayout.MOBILE) {
                webDriver.get(this.contextRoot.toExternalForm() + "mobile/"); // because of '#' in URLs
            }
            webDriver.get(contextRoot.toExternalForm() + addition);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.