Package org.openqa.selenium.interactions

Examples of org.openqa.selenium.interactions.Actions


        // selected in tree)
        for (int i = 1; i <= 4; i++) {
            WebElement treeItem = getTreeNode(String.format(
                    TreeItemSelectionWithoutImmediate.MENU_ITEM_TEMPLATE, i));

            new Actions(getDriver()).moveToElement(treeItem).click().perform();
            Thread.sleep(100);

            WebElement selectedElement = driver.findElement(By
                    .className("v-tree-node-selected"));
View Full Code Here


        assertThat(slider.getAttribute("class"), containsString("v-disabled"));
    }

    private void moveSlider(int offset) {
        WebElement element = vaadinElement("/VVerticalLayout[0]/Slot[0]/VSlider[0]/domChild[2]/domChild[0]");
        new Actions(driver).dragAndDropBy(element, offset, 0).perform();
        testBench().waitForVaadin();
    }
View Full Code Here

        assertEquals("unexpected day content", "14", days.get(41).getText());

        // navigate to previous month
        WebElement popupBody = popup.findElement(By
                .className("v-datefield-calendarpanel"));
        new Actions(driver).keyDown(Keys.SHIFT).perform();
        popupBody.sendKeys(Keys.ARROW_LEFT);
        new Actions(driver).keyUp(Keys.SHIFT).perform();

        // TODO: remove this once #14406 has been fixed
        if (!getBrowsersExcludingIE().contains(getDesiredCapabilities())
                && !Browser.IE8.getDesiredCapabilities().equals(
                        getDesiredCapabilities())) {
            popup.findElement(
                    By.className("v-datefield-calendarpanel-prevmonth"))
                    .findElement(By.tagName("button")).click();
        }

        // verify contents
        assertEquals(
                "unexpected month",
                "tammikuu 2010",
                popup.findElements(
                        By.className("v-datefield-calendarpanel-month")).get(1)
                        .getText());
        weeknumbers = popup.findElements(By
                .className("v-datefield-calendarpanel-weeknumber"));
        assertEquals("unexpected weeknumber count", 6, weeknumbers.size());
        assertEquals("unexpected weeknumber content", "53", weeknumbers.get(0)
                .getText());
        assertEquals("unexpected weeknumber content", "5", weeknumbers.get(5)
                .getText());
        assertEquals(
                "unexpected selection",
                0,
                popup.findElements(
                        By.className("v-datefield-calendarpanel-day-selected"))
                        .size());
        // TODO: remove this check once #14406 has been fixed -- clicking the
        // button instead of navigating with arrow keys steals the focus
        if (getBrowsersExcludingIE().contains(getDesiredCapabilities())
                || Browser.IE8.getDesiredCapabilities().equals(
                        getDesiredCapabilities())) {
            assertEquals(
                    "unexpected focus",
                    "16",
                    popup.findElement(
                            By.className("v-datefield-calendarpanel-day-focused"))
                            .getText());
        }
        days = popup
                .findElements(By.className("v-datefield-calendarpanel-day"));
        assertEquals("unexpected day count", 42, days.size());
        assertEquals("unexpected day content", "28", days.get(0).getText());
        assertEquals("unexpected day content", "5", days.get(8).getText());
        assertEquals("unexpected day content", "22", days.get(25).getText());
        assertEquals("unexpected day content", "7", days.get(41).getText());

        // navigate to previous year
        new Actions(driver).keyDown(Keys.SHIFT).perform();
        popupBody.sendKeys(Keys.ARROW_DOWN);
        new Actions(driver).keyUp(Keys.SHIFT).perform();

        // TODO: remove this once #14406 has been fixed
        popup.findElement(By.className("v-datefield-calendarpanel-prevyear"))
                .findElement(By.tagName("button")).click();
View Full Code Here

        openTestURL();

        WebElement day = findElements(By.className("v-calendar-day-number"))
                .get(2);
        // IE8 requires you to click on the text part to fire the event
        new Actions(getDriver()).moveToElement(day, day.getSize().getWidth() - 3, day.getSize().getHeight() / 2).click().perform();

        // check that a notification was opened, this is done with a log instead
        // of a screenshot or element presence check due to problems with IE
        // webdriver
        String text = findElement(By.id("Log")).findElement(
                By.className("v-label")).getText();
        Assert.assertTrue("Notification should've opened",
                "1. Opening a notification".equals(text));

        // move the mouse around a bit
        new Actions(getDriver()).moveByOffset(5, 5).moveByOffset(100, 100)
                .perform();

        // wait until the notification has animated out
        sleep(1000);
View Full Code Here

        String firstMonth = getSelectedMonth();
        WebElement nextMonthButton = driver.findElement(By
                .className("v-button-nextmonth"));

        // Click and hold left mouse button to start fast forwarding.
        new Actions(driver).clickAndHold(nextMonthButton).perform();
        sleep(1000);

        // Right click and release the left button.

        new Actions(driver).contextClick(nextMonthButton)
                .release(nextMonthButton).perform();

        // Now the fast forwarding should be ended, get the expected month.
        String expectedMonth = getSelectedMonth();
View Full Code Here

        return getDriver().findElement(
                By.xpath("//span[text() = '" + caption + "']"));
    }

    private void doubleClick(WebElement element) {
        new Actions(getDriver()).doubleClick(element).build().perform();

    }
View Full Code Here

        openPopup();
        menuBar = selectMenuBar();

        WebElement menuBarItem = findElement(By
                .className("v-menubar-menuitem-caption"));
        Actions actions = new Actions(getDriver());
        actions.moveToElement(menuBarItem).build().perform();
        menuBar.click();
        Assert.assertFalse("Combobox popup items are visible",
                isElementPresent(By.className("gwt-MenuItem")));
    }
View Full Code Here

        ComboBoxElement combobox = $(ComboBoxElement.class).first();
        combobox.click();
        combobox.openPopup();
        combobox.focus();

        Actions actions = new Actions(getDriver());
        actions.moveToElement(
                getDriver().findElement(By.className("gwt-MenuItem"))).build()
                .perform();
    }
View Full Code Here

    private MenuBarElement selectMenuBar() {
        MenuBarElement menuBar = $(MenuBarElement.class).first();
        menuBar.focus();

        Actions actions = new Actions(getDriver());
        actions.moveToElement(menuBar).build().perform();

        return menuBar;
    }
View Full Code Here

    @Test
    public void textAreaEnterEventPropagation() throws InterruptedException {
        openTestURL();
        WebElement textArea = $(TextAreaElement.class).first();
        Actions builder = new Actions(driver);
        builder.click(textArea);
        builder.sendKeys(textArea, "first line asdf");
        builder.sendKeys(Keys.ENTER);
        builder.sendKeys(textArea, "second line jkl;");
        builder.perform();

        // Should not have triggered shortcut
        assertEquals(" ", getLogRow(0));
    }
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.