@Override public SelenideElement execute(SelenideElement proxy, WebElementSource locator, Object[] args) { SelenideElement target; if (args[0] instanceof String) { target = ElementFinder.wrap(locator.driver(), By.cssSelector((String) args[0])); } else if (args[0] instanceof WebElement) { target = WebElementWrapper.wrap(locator.driver(), (WebElement) args[0]); } else { throw new IllegalArgumentException("Unknown target type: " + args[0] + " (only String or WebElement are supported)"); } target.shouldBe(visible); new Actions(locator.driver().getWebDriver()).dragAndDrop(locator.getWebElement(), target).perform(); return proxy; } }
@Override protected void doPerform() { WebElement targetElem = getFirstElement(target); if (targetOffset == null) { getActions().dragAndDrop(getFirstElement(), targetElem).perform(); } else { org.openqa.selenium.Dimension size = targetElem.getSize(); Dimension dimension = new Dimension(size.width, size.height); Point offsetPoint = targetOffset.offset(dimension); getActions().dragAndDropBy(getFirstElement(), offsetPoint.x(), offsetPoint.y()).perform(); } } }
@Override public Actions dragAndDrop(WebElement source, WebElement target) { super.dragAndDrop(source, target); return this; }
WebElement eleFrom = driver.findElement(By.xpath("//*[@id='draggable']")); WebElement eleTo = driver.findElement(By.xpath("//*[@id='droppable']")); Actions action = new Actions(driver); action.dragAndDrop(eleFrom, eleTo).perform();
Actions act = new Actions(driver); WebElement srcElement = driver.findElement(By .id(locator)); Thread.sleep(3000); WebElement targetElement =driver.findElement(By .id(locator)); Thread.sleep(3000); act.dragAndDrop(srcElement, targetElement); Thread.sleep(3000); act.build().perform(); Thread.sleep(3000);
WebElement source = driver.findElement(By.xpath("//*[@id='sidebar-wrapper']/div/div/nginclude/div[2]/accordion/div/div[1]/div[2]/div/div/div[1]/div[2]")); Thread.sleep(4000); System.out.println("Element Selected to Drag"); WebElement target = driver.findElement(By.xpath("//*[@id='workspace']/div/div/div/div[2]/div/div/div/div[2]/span")); Thread.sleep(4000); Actions builder = new Actions(driver); Action mouseOverHome = builder.dragAndDrop(source, target).build(); mouseOverHome.perform();
WebElement fromElement= driver.findElement(By.xpath("SourceElement")); WebElement toElement=driver.findElement(By.xpath("TragetElement")); Actions action = new Actions(WebDriver); Action dragDrop = action.dragAndDrop(fromElement, toElement).build(); dragDrop.perform();
public Actions dragDrop(Supplier<By> drag, Supplier<By> drop) { Actions build = new Actions(driver); build.dragAndDrop(driver.findElement(drag.get()), driver.findElement(drop.get())).perform(); return build; }
/** * Simulates a drag from source element and drop to target element * @param source element to start the drag * @param target element to end the drag */ public void dragAndDrop(WebElement source, WebElement target) { getActions().dragAndDrop(source, target).perform(); }
@Override protected Void action(WebKey key, Object... param) throws ExecutionException { WebElement from = fetcher.fetchElement(key); WebElement to = fetcher.fetchElement((WebKey) param[0]); Actions actions = new Actions(driver); actions.dragAndDrop(from, to); actions.perform(); return null; } };
public void dragAndDrop(Element target) { invoker.doJAction(format("Drag and drop to Target Element: %s", target.toString()), () -> new Actions(getDriver()).dragAndDrop(getWebElement(), target.getWebElement()).build() .perform()); } }
public void dragAndDrop(Element target) { invoker.doJAction(format("Drag and drop to Target Element: %s", target.toString()), () -> new Actions(getDriver()).dragAndDrop(getWebElement(), target.getWebElement()).build().perform()); } }
public void dragAndDrop(Element target) { invoker.doJAction(format("Drag and drop to Target Element: %s", target.toString()), () -> new Actions(getDriver()).dragAndDrop(getWebElement(), target.getWebElement()).build() .perform()); } }
public EditIssueTypeSchemePage removeIssueType(String issueType) { final WebElement source = getIssueTypeListItemFromSelectedOptions(issueType); assertNotNull("Could not find element for issue type in 'Current Options'.", source); final Actions actions = new Actions(driver) .dragAndDrop(source, availableOptions()); actions.build().perform(); return this; }
@Override protected Result executeImpl(Context context, String... curArgs) { WebDriver driver = context.getWrappedDriver(); WebDriverElementFinder finder = context.getElementFinder(); WebElement elementFrom = finder.findElement(driver, curArgs[ARG_LOCATOR_FROM]); WebElement elementTo = finder.findElement(driver, curArgs[ARG_LOCATOR_TO]); new Actions(driver).dragAndDrop(elementFrom, elementTo).perform(); return SUCCESS; } }
public EditIssueTypeSchemePage selectIssueType(String issueType) { final WebElement source = getIssueTypeListItemFromAvailableOptions(issueType); assertNotNull("Could not find element for issue type in 'Available Options'.", source); final Actions actions = new Actions(driver) .dragAndDrop(source, selectedOptionsWebElement); ((Locatable)source).getCoordinates().inViewPort(); //scrolls the page to make this element visible in the viewport actions.build().perform(); return this; }
public void dragAndDrop(FluentElement dropElement) { Actions actions = new Actions(webDriver); actions.dragAndDrop(element, dropElement.element()); actions.perform(); }
public void dragAndDrop(String locatorSrc, String locatorDest) { LOG.keywordAppender() .appendLocator("Source: " + locatorSrc) .appendLocator("Destination: " + locatorDest); WebElement element = finder.find(locatorSrc); WebElement target = finder.find(locatorDest); new Actions(driver).dragAndDrop(element, target).perform(); }
@Override public boolean run(TestRun ctx) { new Actions(ctx.driver()).dragAndDrop( ctx.locator("locator").find(ctx), ctx.locator("locator2").find(ctx)).build().perform(); return true; } }
public void move_to(Element other_element) { takeScreenshot(); action("Moving element '" + this + "' to element '" + other_element + "'"); Actions drag = new Actions(browser.driver()); try { drag.dragAndDrop(_nativeWebElement(), other_element._nativeWebElement()); action("Moved element '" + this + "' to element '" + other_element + "'"); } catch (org.openqa.selenium.interactions.MoveTargetOutOfBoundsException mtoobe) { error("Cannot move element '" + this + "' to element '" + other_element + "', got org.openqa.selenium.interactions.MoveTargetOutOfBoundsException"); } takeScreenshot(); }