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