Package org.openqa.selenium.interactions

Examples of org.openqa.selenium.interactions.Actions


        Assert.assertEquals("Shadow width", "300px", shadow.getCssValue("width"));
        Assert.assertEquals("Container height", "200px", container.getCssValue("height"));
        Assert.assertEquals("Shadow height", "200px", shadow.getCssValue("height"));

        WebElement resizeHandle = browser.findElement(By.id("myForm:popupResizerSE"));
        Actions builder = new Actions(browser);

        final Action dragAndDrop = builder.dragAndDropBy(resizeHandle, 40, 40).build();
        dragAndDrop.perform();

        Assert.assertEquals("Container width", "340px", container.getCssValue("width"));
        Assert.assertEquals("Shadow width", "340px", shadow.getCssValue("width"));
        Assert.assertEquals("Container height", "240px", container.getCssValue("height"));
View Full Code Here


     * Mouse down on element + initial offset -> Moves the "move offset" ->
     * Mouse up
     */
    private void clickAndMove(WebElement element, int initialX, int initialY,
            int moveX, int moveY) {
        new Actions(driver).moveToElement(element, initialX, initialY)
                .clickAndHold().perform();
        new Actions(driver).moveByOffset(moveX, moveY).perform();
        new Actions(driver).release().perform();
    }
View Full Code Here

    /**
     * Mouse down on elementFrom -> Moves to elementTo -> Mouse up
     */
    private void clickAndMove(WebElement elementFrom, WebElement elementTo) {
        new Actions(driver).moveToElement(elementFrom, 5, 5).clickAndHold()
                .perform();
        new Actions(driver).moveToElement(elementTo, 5, 5).perform();
        new Actions(driver).release().perform();
    }
View Full Code Here

    public static class ActionsProvider extends IndirectProvider<Actions, HasInputDevices> {
        @Override
        public Actions generateProxy(HasInputDevices base) {
            Keyboard keyboard = base.getKeyboard();
            Mouse mouse = base.getMouse();
            return new Actions(keyboard, mouse);
        }
View Full Code Here

   * @return True if the ProfileCard appeared, false if not.
   */
  public boolean isProfileCardDisplayable(WebElement cardAttachPoint){
    WebDriver driver = getWebDriver();
   
    new Actions(driver).moveToElement(cardAttachPoint).perform(); // hover over the attachpoint to make the semtagmenu appear.
   
    WebDriverWait wait = new WebDriverWait(driver, 5);
    WebElement semtagmenu = wait.until(ExpectedConditions.elementToBeClickable(By.id("semtagmenu"))); // wait until the hover menu is clickable.
   
    WebElement semTagHoverMenu = semtagmenu.findElement(By.xpath(".//a"));
    new Actions(driver).click(semTagHoverMenu).perform(); // click the hovering menu
    WebElement vCardDiv = wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("cardDiv")));
   
    return vCardDiv.isDisplayed();
  }
View Full Code Here

        checkInitializationOfWebElements(testPage.getParagraphs(), "Inside PageObject");
    }

    @Test
    public void testSupportForAdvancedActions() {
        Actions builder = new Actions(selenium);

        // following tests usage of Actions with injected plain WebElement
        builder.click(input);
        // following with List<WebElement>
        builder.click(divs.get(0));
        // following with WebElements from Page Fragments
        builder.click(abstractPageFragmentStub.getLocatorRefByXPath());
        // following with List of WebElements from Page Fragments
        builder.click(abstractPageFragmentStub.getSpansInPageFragment().get(0));

        builder.perform();
    }
View Full Code Here

        Mouse mouse = mock(Mouse.class);
        Keyboard keyboard = mock(Keyboard.class);
        when(((HasInputDevices) driver).getMouse()).thenReturn(mouse);
        when(((HasInputDevices) driver).getKeyboard()).thenReturn(keyboard);
        // when
        Actions actions = (Actions) provider.lookup(null, null);
        actions.click().perform();
        // then
        verify(mouse).click(null);
        verifyNoMoreInteractions(mouse, keyboard);
    }
View Full Code Here

    }

    @Test
    public void testStalenessAndActionsOnWebDriver1() {
        WebElement stale = browser.findElement(By.className("stale"));
        Action action = new Actions(browser).clickAndHold(stale).release(stale).build();
        makeStale.click();
        action.perform();
    }
View Full Code Here

    }

    @Test
    public void testStalenessAndActionsOnWebDriver2() {
        WebElement stale = browser.findElement(By.className("stale"));
        Action action = new Actions(browser).moveToElement(stale).build();
        makeStale.click();
        action.perform();
    }
View Full Code Here

    }

    @Test
    public void testStalenessAndActionsOnWebElement1() {
        WebElement inStale = browser.findElement(By.className("stale")).findElement(By.className("in-stale"));
        Action action = new Actions(browser).clickAndHold(inStale).release(inStale).build();
        makeStale.click();
        action.perform();
    }
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.