Package org.openqa.selenium.interactions

Examples of org.openqa.selenium.interactions.Actions


        textfield.focus();
        textfield.sendKeys("test");

        $(ButtonElement.class).first().click();

        new Actions(getDriver()).contextClick(textfield).perform();

        Assert.assertEquals("test", textfield.getValue());
    }
View Full Code Here


                .findElement(By.className("v-button"));

        button.click();

        // Loose the focus from the button.
        new Actions(getDriver())
                .moveToElement(panelScrollable, panelScrollableSize.width / 2,
                        panelScrollableSize.height / 2).click().build()
                .perform();

        compareScreen("window");
View Full Code Here

                By.className("v-window-footer"));

        final Point winPos = window.getLocation();

        // move window
        Action a = new Actions(driver).clickAndHold(windowFooter)
                .moveByOffset(100, 100).release().build();
        a.perform();
        assertNotEquals("Window was not dragged correctly.", winPos.x,
                window.getLocation().x);
        assertNotEquals("Window was not dragged correctly.", winPos.y,
View Full Code Here

    protected void moveMouseToTopLeft(WebElement element) {
        moveMouseTo(element, 0, 0);
    }

    protected void moveMouseTo(WebElement element, int offsetX, int offsetY) {
        new Actions(getDriver()).moveToElement(element, offsetX, offsetY)
                .perform();
    }
View Full Code Here

        /*
         * Selenium doesn't properly drag and drop items in IE8. It tries to
         * start dragging an element from a position above the element itself.
         */
        if (BrowserUtil.isIE8(getDesiredCapabilities())) {
            Actions action = new Actions(getDriver());
            action.moveToElement(element);
            action.moveByOffset(0, 1);
            action.clickAndHold();
            action.moveByOffset(xOffset, yOffset);
            action.release();
            action.build().perform();
        } else {
            Actions action = new Actions(getDriver());
            action.dragAndDropBy(element, xOffset, yOffset);
            action.build().perform();
        }
    }
View Full Code Here

    private void closePopup() {
        WebElement dateFieldButton = dateField.findElement(By
                .className("v-datefield-button"));
        // To work reliably with IE, need to click and hold instead of just
        // clicking the button.
        Actions actions = new Actions(driver);
        actions.clickAndHold(dateFieldButton).perform();
    }
View Full Code Here

    }

    private void openPopup() throws InterruptedException {
        Dimension size = getInput().getSize();
        new Actions(getDriver()).moveToElement(getInput(), 0, 0)
                .moveByOffset(size.getWidth() + 5, size.getHeight() / 2)
                .click();
        // This fails in Opera for some weird reason
        // getDriver().findElement(By.className("v-datefield-button")).click();
    }
View Full Code Here

     * @param string
     */
    private void menuSub(String string) {
        getDriver().findElement(By.xpath("//span[text() = '" + string + "']"))
                .click();
        new Actions(getDriver()).moveByOffset(100, 0).build().perform();
    }
View Full Code Here

        List<WebElement> textFields = getDriver().findElements(
                By.tagName("input"));
        WebElement tf1 = textFields.get(0);
        WebElement tf2 = textFields.get(1);
        tf1.sendKeys(initialText);
        new Actions(getDriver()).moveToElement(tf2).click().build().perform();

        WebElement activeElement = getFocusedElement();
        Assert.assertEquals("input", activeElement.getTagName());
        Assert.assertEquals("", activeElement.getAttribute("value"));

        tf1.sendKeys(incrementalText);
        new Actions(getDriver())
                .moveToElement(
                        getDriver().findElement(By.className("v-button")))
                .click().build().perform();
        activeElement = getFocusedElement();
        Assert.assertEquals("Just a button", activeElement.getText());
View Full Code Here

        String firstText = "This is";
        String secondText = " default value";

        tf2.sendKeys(firstText);
        tf1.sendKeys(initialText);
        new Actions(getDriver()).moveToElement(tf2).click().build().perform();

        WebElement activeElement = getFocusedElement();
        Assert.assertEquals("input", activeElement.getTagName());
        Assert.assertEquals(firstText, activeElement.getAttribute("value"));

        new Actions(getDriver()).sendKeys(secondText).build().perform();
        DesiredCapabilities capabilities = getDesiredCapabilities();
        if (capabilities.equals(BrowserUtil.ie(8))
                || capabilities.equals(BrowserUtil.ie(9))) {
            // IE8 and IE9 insert cursor in the start of input instead of end.
            Assert.assertEquals(secondText + firstText,
View Full Code Here

TOP

Related Classes of org.openqa.selenium.interactions.Actions

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.