@JavascriptEnabled @Ignore({HTMLUNIT, IE, CHROME, SELENESE}) public void testDragTooFar() { driver.get(dragAndDropPage); RenderedWebElement img = (RenderedWebElement) driver.findElement(By.id("test1")); // Point expectedLocation = img.getLocation(); img.dragAndDropBy(Integer.MIN_VALUE, Integer.MIN_VALUE); assertEquals(new Point(0, 0), img.getLocation()); img.dragAndDropBy(Integer.MAX_VALUE, Integer.MAX_VALUE); // We don't know where the img is dragged to , but we know it's not too // far, otherwise this function will not return for a long long time }
private void drag( RenderedWebElement elem, Point expectedLocation, int moveRightBy, int moveDownBy) { elem.dragAndDropBy(moveRightBy, moveDownBy); expectedLocation.move(expectedLocation.x + moveRightBy, expectedLocation.y + moveDownBy); }