Search in sources :

Example 61 with Actions

use of org.openqa.selenium.interactions.Actions in project ORCID-Source by ORCID.

the class BlackBoxBase method removePopOver.

public static void removePopOver() {
    Actions a = new Actions(webDriver);
    a.moveByOffset(500, 500).perform();
}
Also used : Actions(org.openqa.selenium.interactions.Actions)

Example 62 with Actions

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

the class MouseCommandsTest method move.

@Test
public void move() {
    WebDriver d = getDriver();
    Actions actionBuilder = new Actions(d);
    d.get("http://www.duckduckgo.com");
    // Move mouse by x,y
    actionBuilder.moveByOffset(100, 100).build().perform();
    // Move mouse on a given element
    actionBuilder.moveToElement(d.findElement(By.id("logo_homepage_link"))).build().perform();
    // Move mouse on a given element, by x,y relative coordinates
    actionBuilder.moveToElement(d.findElement(By.id("logo_homepage_link")), 50, 50).build().perform();
}
Also used : WebDriver(org.openqa.selenium.WebDriver) Actions(org.openqa.selenium.interactions.Actions) Test(org.junit.Test)

Example 63 with Actions

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

the class MouseCommandsTest method clickAndRightClick.

@Test
public void clickAndRightClick() {
    WebDriver d = getDriver();
    Actions actionBuilder = new Actions(d);
    d.get("http://www.duckduckgo.com");
    // Left click
    actionBuilder.click().build().perform();
    // Right click
    actionBuilder.contextClick(null).build().perform();
    // Right click on the logo (it will cause a "/moveto" before clicking
    actionBuilder.contextClick(d.findElement(By.id("logo_homepage_link"))).build().perform();
}
Also used : WebDriver(org.openqa.selenium.WebDriver) Actions(org.openqa.selenium.interactions.Actions) Test(org.junit.Test)

Example 64 with Actions

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

the class ParagraphActionsIT method testCreateNewButton.

@Test
public void testCreateNewButton() throws Exception {
    if (!endToEndTestEnabled()) {
        return;
    }
    try {
        createNewNote();
        Actions action = new Actions(driver);
        waitForParagraph(1, "READY");
        Integer oldNosOfParas = driver.findElements(By.xpath("//div[@ng-controller=\"ParagraphCtrl\"]")).size();
        collector.checkThat("Before Insert New : the number of  paragraph ", oldNosOfParas, CoreMatchers.equalTo(1));
        driver.findElement(By.xpath(getParagraphXPath(1) + "//span[@class='icon-settings']")).click();
        driver.findElement(By.xpath(getParagraphXPath(1) + "//ul/li/a[@ng-click=\"insertNew('below')\"]")).click();
        waitForParagraph(2, "READY");
        Integer newNosOfParas = driver.findElements(By.xpath("//div[@ng-controller=\"ParagraphCtrl\"]")).size();
        collector.checkThat("After Insert New (using Insert New button) :  number of  paragraph", oldNosOfParas + 1, CoreMatchers.equalTo(newNosOfParas));
        driver.findElement(By.xpath(getParagraphXPath(1) + "//span[@class='icon-settings']")).click();
        driver.findElement(By.xpath(getParagraphXPath(1) + "//ul/li/a[@ng-click='removeParagraph(paragraph)']")).click();
        ZeppelinITUtils.sleep(1000, false);
        driver.findElement(By.xpath("//div[@class='modal-dialog'][contains(.,'delete this paragraph')]" + "//div[@class='modal-footer']//button[contains(.,'OK')]")).click();
        ZeppelinITUtils.sleep(1000, false);
        setTextOfParagraph(1, " original paragraph ");
        WebElement newPara = driver.findElement(By.xpath(getParagraphXPath(1) + "//div[contains(@class,'new-paragraph')][1]"));
        action.moveToElement(newPara).click().build().perform();
        ZeppelinITUtils.sleep(1000, false);
        waitForParagraph(1, "READY");
        collector.checkThat("Paragraph is created above", driver.findElement(By.xpath(getParagraphXPath(1) + "//div[contains(@class, 'editor')]")).getText(), CoreMatchers.equalTo(StringUtils.EMPTY));
        setTextOfParagraph(1, " this is above ");
        newPara = driver.findElement(By.xpath(getParagraphXPath(2) + "//div[contains(@class,'new-paragraph')][2]"));
        action.moveToElement(newPara).click().build().perform();
        waitForParagraph(3, "READY");
        collector.checkThat("Paragraph is created below", driver.findElement(By.xpath(getParagraphXPath(3) + "//div[contains(@class, 'editor')]")).getText(), CoreMatchers.equalTo(StringUtils.EMPTY));
        setTextOfParagraph(3, " this is below ");
        collector.checkThat("The output field of paragraph1 contains", driver.findElement(By.xpath(getParagraphXPath(1) + "//div[contains(@class, 'editor')]")).getText(), CoreMatchers.equalTo(" this is above "));
        collector.checkThat("The output field paragraph2 contains", driver.findElement(By.xpath(getParagraphXPath(2) + "//div[contains(@class, 'editor')]")).getText(), CoreMatchers.equalTo(" original paragraph "));
        collector.checkThat("The output field paragraph3 contains", driver.findElement(By.xpath(getParagraphXPath(3) + "//div[contains(@class, 'editor')]")).getText(), CoreMatchers.equalTo(" this is below "));
        collector.checkThat("The current number of paragraphs after creating  paragraph above and below", driver.findElements(By.xpath("//div[@ng-controller=\"ParagraphCtrl\"]")).size(), CoreMatchers.equalTo(3));
        deleteTestNotebook(driver);
    } catch (Exception e) {
        handleException("Exception in ParagraphActionsIT while testCreateNewButton ", e);
    }
}
Also used : Actions(org.openqa.selenium.interactions.Actions) WebElement(org.openqa.selenium.WebElement) Test(org.junit.Test)

Example 65 with Actions

use of org.openqa.selenium.interactions.Actions in project rstudio by rstudio.

the class DataImportTests method testImportCSVFile.

@Test
public void testImportCSVFile() throws Exception {
    WebElement menuEntry = MenuNavigator.getMenuItem(driver_, "Tools", "Import Dataset", "From Text File...");
    menuEntry.click();
    final WebElement importFileDialog = DialogTestUtils.waitForModalToAppear(driver_);
    DialogTestUtils.waitForFocusedInput(driver_, importFileDialog);
    Actions typeName = new Actions(driver_);
    File csvFile = new File("test/org/rstudio/studio/selenium/resources/banklist.csv");
    typeName.sendKeys(csvFile.getAbsolutePath());
    typeName.perform();
    DialogTestUtils.respondToModalDialog(driver_, "Open");
    // After a moment the modal prompting for the path will disappear, and
    // the modal prompting for input will appear. 
    (new WebDriverWait(driver_, 5)).until(new ExpectedCondition<Boolean>() {

        public Boolean apply(WebDriver d) {
            List<WebElement> elements = driver_.findElements(By.className("gwt-DialogBox-ModalDialog"));
            if (elements.size() > 0) {
                if (elements.get(0).getText().contains("Import Dataset")) {
                    return true;
                }
            }
            return false;
        }
    });
    DialogTestUtils.respondToModalDialog(driver_, "Import");
    ConsoleTestUtils.waitForConsoleContainsText(driver_, "read.csv");
    // Once the CSV has been read, make sure all the rows made it to the
    // generated object
    ConsoleTestUtils.beginConsoleInteraction(driver_);
    (new Actions(driver_)).sendKeys(Keys.ESCAPE + "nrow(banklist)" + Keys.ENTER).perform();
    ConsoleTestUtils.waitForConsoleContainsText(driver_, "515");
}
Also used : WebDriver(org.openqa.selenium.WebDriver) Actions(org.openqa.selenium.interactions.Actions) WebDriverWait(org.openqa.selenium.support.ui.WebDriverWait) List(java.util.List) WebElement(org.openqa.selenium.WebElement) File(java.io.File) Test(org.junit.Test)

Aggregations

Actions (org.openqa.selenium.interactions.Actions)116 WebElement (org.openqa.selenium.WebElement)72 WebDriver (org.openqa.selenium.WebDriver)26 Test (org.junit.Test)21 FirefoxDriver (org.openqa.selenium.firefox.FirefoxDriver)18 PublicAtsApi (com.axway.ats.common.PublicAtsApi)16 Action (org.openqa.selenium.interactions.Action)10 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 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 VerticalLayoutElement (com.vaadin.testbench.elements.VerticalLayoutElement)1