List of usage examples for org.openqa.selenium.interactions Actions release
public Actions release(WebElement target)
From source file:org.eclipse.che.selenium.core.webdriver.SeleniumWebDriverHelper.java
License:Open Source License
/** * Performs clicking and holding an {@code element} during specified {@code timeout}. * * @param element target element//from w w w . j ava2 s .co m * @param holdingTimeout time for element holding */ public void clickAndHoldElementDuringTimeout(WebElement element, int holdingTimeout) { Actions action = getAction(); action.clickAndHold(waitVisibility(element)).perform(); WaitUtils.sleepQuietly(holdingTimeout); action.release(waitVisibility(element)).perform(); }
From source file:org.finra.jtaf.ewd.widget.element.InteractiveElement.java
License:Apache License
@Override public void releaseClickAndHold() throws WidgetException { try {/* w w w .j a v a 2s .co m*/ Actions builder = new Actions(getGUIDriver().getWrappedDriver()); synchronized (InteractiveElement.class) { getGUIDriver().focus(); builder.release(getWebElement()).build().perform(); } } catch (Exception e) { throw new WidgetException("Error while releasing click and hold", getLocator(), e); } }
From source file:org.richfaces.tests.metamer.ftest.richDragSource.AbstractDragSourceTest.java
License:Open Source License
public void testDefaultIndicator() { indicator = new Indicator(page.defaultIndicator); indicator.setDefaultIndicator(true); dragSourceAttributes.set(dragIndicator, ""); Actions actionQueue = new Actions(driver); Action clickAndHold = actionQueue.clickAndHold(page.drag1).build(); clickAndHold.perform();//from w w w . j ava 2 s. c om assertTrue(elementNotPresent.element(page.defaultIndicator).apply(driver)); Action move = actionQueue.moveByOffset(1, 1).build(); move.perform(); assertTrue(elementPresent.element(page.defaultIndicator).apply(driver)); testMovingOverDifferentStates(); Action drop = actionQueue.release(page.drop1).build(); drop.perform(); }
From source file:org.richfaces.tests.metamer.ftest.richDragSource.TestDragSource.java
License:Open Source License
@Test @IssueTracking({ "https://issues.jboss.org/browse/RF-12441", "https://issues.jboss.org/browse/RF-14081", "https://issues.jboss.org/browse/RF-14229" }) @Uses({ @UseWithField(field = "indicatorValue", valuesFrom = ValuesFrom.STRINGS, value = { "", "indicator", "indicator2" }), @UseWithField(field = "dragOptionsValue", valuesFrom = ValuesFrom.STRINGS, value = { "", "predefinedWithHelper", "predefinedWithoutHelper" }) }) @CoversAttributes({ "dragIndicator", "dragOptions" }) public void testDragIndicatorAndOptions() { // setup attributes attsSetter().setAttribute("dragIndicator").toValue(indicatorValue).setAttribute("dragOptions") .toValue(dragOptionsValue).asSingleAction().perform(); // setup indicator boolean isDragOptionsWithHelper = dragOptionsValue.equals("predefinedWithHelper"); boolean isDefaultIndicatorUsed = indicatorValue.isEmpty() || isDragOptionsWithHelper; GrapheneElement indicatorElement = isDefaultIndicatorUsed ? getPage().getDefaultIndicatorElement() : indicatorValue.equals("indicator") ? getPage().getIndicatorElement() : getPage().getIndicator2Element(); indicator = new Indicator(indicatorElement); indicator.setDefaultIndicator(isDefaultIndicatorUsed); // check no errors are present in browser's console assertEquals(jsErrorStorage.getMessages().size(), 0); Actions actionQueue = new Actions(driver); try {/*from w w w . ja v a2 s. c o m*/ actionQueue.clickAndHold(getPage().getDrag1Element()).moveByOffset(1, 1).perform(); assertTrue(indicatorElement.isPresent()); if (!dragOptionsValue.isEmpty()) { // check indicator has predefined properties from @dragOptions for (Entry<String, String> e : dragOptionsValueMap.get(dragOptionsValue)) { // when using DragOptionsWithoutHelper, the opacity is used from the indicator if (!e.getKey().equals("opacity") || isDragOptionsWithHelper) { assertEquals(indicatorElement.getCssValue(e.getKey()), e.getValue()); } } } // check it is working testMovingOverDifferentStates(); } finally { actionQueue.release(getPage().getDrop1Element()).perform(); } // check no errors are present in browser's console assertEquals(jsErrorStorage.getMessages().size(), 0); }