List of usage examples for org.openqa.selenium.interactions Actions release
public Actions release()
From source file:com.liferay.cucumber.selenium.BaseWebDriverImpl.java
License:Open Source License
@Override public void mouseRelease() { WebElement bodyWebElement = getWebElement("//body"); WrapsDriver wrapsDriver = (WrapsDriver) bodyWebElement; WebDriver webDriver = wrapsDriver.getWrappedDriver(); Actions actions = new Actions(webDriver); actions.release(); Action action = actions.build(); action.perform();/* w w w . j av a2 s. c o m*/ }
From source file:com.liferay.cucumber.selenium.BaseWebDriverImpl.java
License:Open Source License
@Override public void mouseUpAt(String locator, String coordString) { WebElement webElement = getWebElement(locator); scrollWebElementIntoView(webElement); WrapsDriver wrapsDriver = (WrapsDriver) webElement; WebDriver webDriver = wrapsDriver.getWrappedDriver(); Actions actions = new Actions(webDriver); if (Validator.isNotNull(coordString) && coordString.contains(",")) { String[] coords = coordString.split(","); int x = GetterUtil.getInteger(coords[0]); int y = GetterUtil.getInteger(coords[1]); actions.moveToElement(webElement, x, y); actions.release(); } else {//w ww.j a v a 2 s . c o m actions.moveToElement(webElement); actions.release(webElement); } Action action = actions.build(); action.perform(); }
From source file:com.mycompany.fullslidertest.FullsliderTest.java
public void addSlideAndReorder() { createPresentation("Add slide and reorder it"); js.executeScript("$('#addslidebtn').click()"); js.executeScript("$('#addtextbtn').click()"); WebElement draggableText = driver/*w w w . j a v a 2s .c om*/ .findElement(By.xpath("//div[@id='workspace']/div[2]/div/section[2]/div[3]")); waitForAction(); actions.dragAndDropBy(draggableText, 10, 200).build().perform(); draggableText.click(); WebElement draggableSlide1 = driver .findElement(By.xpath("//div[@id='vertical-toolbar']/div/div/div/div[1]")); WebElement draggableSlide2 = driver .findElement(By.xpath("//div[@id='vertical-toolbar']/div/div/div/div[2]")); int offset = draggableSlide2.getLocation().getY() - draggableSlide1.getLocation().getY(); Actions builder = new Actions(driver); Actions dragAndDrop = builder.moveToElement(draggableSlide1).clickAndHold().moveByOffset(0, offset + 10) .pause(500); // I found the pauses were necessary to get the test working in other dragAndDrop.release().perform(); waitForAction(); driver.quit(); }
From source file:com.vaadin.testbench.elements.WindowElement.java
License:Apache License
/** * Moves the window by given offset.//from w w w . j ava 2 s . co m * * @param xOffset * x offset * @param yOffset * y offset */ public void move(int xOffset, int yOffset) { Actions action = new Actions(getDriver()); action.moveToElement(findElement(org.openqa.selenium.By.className("v-window-wrap")), 5, 5); action.clickAndHold(); action.moveByOffset(xOffset, yOffset); action.release(); action.build().perform(); }
From source file:com.vaadin.tests.components.calendar.CalendarResizeOverlappingEventsTest.java
License:Apache License
private void dragAndDrop(WebElement element, int yOffset) { /*/*from w w w . j a v a2 s . c om*/ * Selenium doesn't properly drag and drop items in IE8. It tries to * start dragging an element from a position above the element itself. */ if (BrowserUtil.isIE8(getDesiredCapabilities())) { Actions action = new Actions(getDriver()); action.moveToElement(element); action.moveByOffset(0, 1); action.clickAndHold(); action.moveByOffset(0, yOffset); action.release(); action.build().perform(); } else { Actions action = new Actions(getDriver()); action.dragAndDropBy(element, 0, yOffset); action.build().perform(); } }
From source file:com.worldline.easycukes.selenium.pages.Page.java
License:Open Source License
/** * @param selector// w ww .java2s. com */ public void moveToElement(By selector) { final Actions builder = new Actions(driver); builder.moveToElement(getWebElement(selector)).perform(); builder.release(); }
From source file:com.worldline.easycukes.selenium.pages.Page.java
License:Open Source License
public void moveToAndClick(By selector) { final Actions builder = new Actions(driver); builder.moveToElement(getWebElement(selector)).click().perform(); builder.release(); }
From source file:org.eclipse.che.selenium.pageobject.dashboard.workspaces.EditMachineForm.java
License:Open Source License
public void dragSliderButtonToSliderBarCenter() { Actions action = seleniumWebDriverHelper.getAction(); action.clickAndHold(waitSliderButton()).perform(); seleniumWebDriverHelper.moveCursorTo(waitSliderBar()); action.release(); }
From source file:org.eclipse.che.selenium.pageobject.intelligent.CommandsToolbar.java
License:Open Source License
private void waitListIsRenderedAndClickOnItem(String nameOfCommand, Actions action) { testWebElementRenderChecker.waitElementIsRendered(By.id("commandsPopup")); action.release(); clickOnElement(getElementFromCommandsDropDown(nameOfCommand), action); }
From source file:org.eclipse.che.selenium.pageobject.theia.TheiaTerminal.java
License:Open Source License
private void copyTerminalTextToClipboard(int terminalIndex) { Dimension textLayerSize = getTextLayer(terminalIndex).getSize(); final Actions action = seleniumWebDriverHelper.getAction(); final int xBeginCoordinateShift = -(textLayerSize.getWidth() / 2); final int yBeginCoordinateShift = -(textLayerSize.getHeight() / 2); seleniumWebDriverHelper.moveCursorTo(getTextLayer(terminalIndex)); // shift to top left corner seleniumWebDriverHelper.getAction().moveByOffset(xBeginCoordinateShift, yBeginCoordinateShift).perform(); // select all terminal area by mouse action.clickAndHold().perform();/* ww w .jav a 2 s. com*/ seleniumWebDriverHelper.getAction().moveByOffset(textLayerSize.getWidth(), textLayerSize.getHeight()) .perform(); action.release().perform(); // copy terminal output to clipboard String keysCombination = Keys.chord(CONTROL, INSERT); seleniumWebDriverHelper.sendKeys(keysCombination); // cancel terminal area selection clickOnTerminal(terminalIndex); }