Search in sources :

Example 16 with Actions

use of org.openqa.selenium.interactions.Actions in project ghostdriver by detro.

the class MouseCommandsTest method clickAndHold.

@Test
public void clickAndHold() {
    WebDriver d = getDriver();
    Actions actionBuilder = new Actions(d);
    d.get("http://www.duckduckgo.com");
    // Hold, then release
    actionBuilder.clickAndHold().build().perform();
    actionBuilder.release();
    // Hold on the logo, then release
    actionBuilder.clickAndHold(d.findElement(By.id("logo_homepage_link"))).build().perform();
    actionBuilder.release();
}
Also used : WebDriver(org.openqa.selenium.WebDriver) Actions(org.openqa.selenium.interactions.Actions) Test(org.junit.Test)

Example 17 with Actions

use of org.openqa.selenium.interactions.Actions in project zeppelin by apache.

the class ParagraphActionsIT method testEditOnDoubleClick.

@Test
public void testEditOnDoubleClick() throws Exception {
    if (!endToEndTestEnabled()) {
        return;
    }
    try {
        createNewNote();
        Actions action = new Actions(driver);
        waitForParagraph(1, "READY");
        setTextOfParagraph(1, "%md");
        driver.findElement(By.xpath(getParagraphXPath(1) + "//textarea")).sendKeys(Keys.ARROW_RIGHT);
        driver.findElement(By.xpath(getParagraphXPath(1) + "//textarea")).sendKeys(Keys.ENTER);
        driver.findElement(By.xpath(getParagraphXPath(1) + "//textarea")).sendKeys(Keys.SHIFT + "3");
        driver.findElement(By.xpath(getParagraphXPath(1) + "//textarea")).sendKeys(" abc");
        runParagraph(1);
        waitForParagraph(1, "FINISHED");
        collector.checkThat("Markdown editor is hidden after run ", driver.findElements(By.xpath(getParagraphXPath(1) + "//div[contains(@ng-if, 'paragraph.config.editorHide')]")).size(), CoreMatchers.equalTo(0));
        collector.checkThat("Markdown editor is shown after run ", driver.findElement(By.xpath(getParagraphXPath(1) + "//div[contains(@ng-show, 'paragraph.config.tableHide')]")).isDisplayed(), CoreMatchers.equalTo(true));
        // to check if editOnDblClick field is fetched correctly after refresh
        driver.navigate().refresh();
        waitForParagraph(1, "FINISHED");
        action.doubleClick(driver.findElement(By.xpath(getParagraphXPath(1)))).perform();
        ZeppelinITUtils.sleep(1000, false);
        collector.checkThat("Markdown editor is shown after double click ", driver.findElement(By.xpath(getParagraphXPath(1) + "//div[contains(@ng-if, 'paragraph.config.editorHide')]")).isDisplayed(), CoreMatchers.equalTo(true));
        collector.checkThat("Markdown editor is hidden after double click ", driver.findElement(By.xpath(getParagraphXPath(1) + "//div[contains(@ng-show, 'paragraph.config.tableHide')]")).isDisplayed(), CoreMatchers.equalTo(false));
        deleteTestNotebook(driver);
    } catch (Exception e) {
        handleException("Exception in ParagraphActionsIT while testEditOnDoubleClick ", e);
    }
}
Also used : Actions(org.openqa.selenium.interactions.Actions) Test(org.junit.Test)

Example 18 with Actions

use of org.openqa.selenium.interactions.Actions in project selenium-tests by Wikia.

the class ModularMainPageObject method moveCoverImage.

public void moveCoverImage() {
    Actions actions = new Actions(driver);
    actions.clickAndHold(imageWindowDragging).clickAndHold().moveByOffset(-200, -200).release().perform();
}
Also used : Actions(org.openqa.selenium.interactions.Actions)

Example 19 with Actions

use of org.openqa.selenium.interactions.Actions in project selenium-tests by Wikia.

the class InfoboxBuilderPage method dragAndDropToTheTop.

/**
   _   _                     __     _
   | | | |,^.        ,'.      | `.  | |
   | | |  ,. `.    ,'   `.    | . `.| |
   | | | .--`,'  ,'  ,^.  `.  | |`.   |
   | | | |`. `. `. ,'___`. ,' | |  `| |
   |_| |_|  `. `. `._____,'   |_|   | |
   `/                    `.|
   `
   __               _   _   __         ____  __     _
   | `. ,^.       ,' | | | |  `.      |  __| | `.  | |
   | . ' , |  /`,' . | | | | |`.`.    | |__  | . `.| |
   | |`.'| |  `. ,'| | | | | |  `.`.  |  __| | |`.   |
   | |   | | ,' . `. | | | | |____` / | |__  | |  `| |
   |_|   | | \,' `.__| |_| |_______/   `.__| |_|   | |
   `.|                                       `.|

   Dragging move is actually a 20 small moves, to make is a bit slower
   */
public WebElement dragAndDropToTheTop(WebElement draggedElement) {
    this.wait.forElementClickable(draggedElement);
    WebElement infoboxBackground = driver.findElement(By.cssSelector(".portable-infobox.pi-background"));
    Point location = infoboxBackground.getLocation();
    Integer targetY = draggedElement.getLocation().getY() - location.getY() + 50;
    new Actions(driver).clickAndHold(draggedElement).perform();
    for (int i = 0; i < 20; i++) {
        new Actions(driver).moveByOffset(0, -targetY / 20).perform();
    }
    new Actions(driver).release().perform();
    wait.forValueToBeNotPresentInElementsAttribute(draggedElement, "class", "is-dragging");
    wait.forValueToBeNotPresentInElementsAttribute(draggedElement, "class", "is-dropping");
    return component.get(0);
}
Also used : Actions(org.openqa.selenium.interactions.Actions) Point(org.openqa.selenium.Point) WebElement(org.openqa.selenium.WebElement) Point(org.openqa.selenium.Point)

Example 20 with Actions

use of org.openqa.selenium.interactions.Actions in project selenium-tests by Wikia.

the class VisualEditModePageObject method editCategory.

public EditCategoryComponentObject editCategory(String categoryName) {
    WebElement editCategory = driver.findElement(By.cssSelector(categoryEditSelector.replace("%categoryName%", categoryName)));
    WebElement category = driver.findElement(By.cssSelector(".category[data-name='" + categoryName + "']"));
    new Actions(driver).moveToElement(category).sendKeys(Keys.ARROW_DOWN).sendKeys(Keys.ARROW_DOWN).perform();
    scrollAndClick(editCategory);
    PageObjectLogging.log("editCategory", "edit category button clicked on category " + categoryName, true);
    return new EditCategoryComponentObject(driver);
}
Also used : Actions(org.openqa.selenium.interactions.Actions) EditCategoryComponentObject(com.wikia.webdriver.pageobjectsfactory.componentobject.editcategory.EditCategoryComponentObject) WebElement(org.openqa.selenium.WebElement)

Aggregations

Actions (org.openqa.selenium.interactions.Actions)100 WebElement (org.openqa.selenium.WebElement)59 WebDriver (org.openqa.selenium.WebDriver)26 FirefoxDriver (org.openqa.selenium.firefox.FirefoxDriver)18 PublicAtsApi (com.axway.ats.common.PublicAtsApi)16 Test (org.junit.Test)16 HiddenHtmlElementState (com.axway.ats.uiengine.utilities.hiddenbrowser.HiddenHtmlElementState)9 WebDriverWait (org.openqa.selenium.support.ui.WebDriverWait)6 RealHtmlElementState (com.axway.ats.uiengine.utilities.realbrowser.html.RealHtmlElementState)4 List (java.util.List)3 Action (org.openqa.selenium.interactions.Action)3 MobileOperationException (com.axway.ats.uiengine.exceptions.MobileOperationException)2 VerificationException (com.axway.ats.uiengine.exceptions.VerificationException)2 MobileElementState (com.axway.ats.uiengine.utilities.mobile.MobileElementState)2 AndroidDriver (io.appium.java_client.android.AndroidDriver)2 File (java.io.File)2 DecimalFormat (java.text.DecimalFormat)2 JavascriptExecutor (org.openqa.selenium.JavascriptExecutor)2 SystemException (com.github.bordertech.wcomponents.util.SystemException)1 JavascriptActions (com.wikia.webdriver.common.core.elemnt.JavascriptActions)1