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();
}
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();
}
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();
}
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);
}
}
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");
}
Aggregations