コード例 #1
0
 @Test
 public void dragandDropTest() {
   Actions action = new Actions(driver);
   driver.switchTo().frame(0);
   WebElement source = driver.findElement(By.id("draggable"));
   WebElement target = driver.findElement(By.id("droppable"));
   action.dragAndDrop(source, target).build().perform();
 }
コード例 #2
0
  public static void main(String... args) {
    WebDriver driver = new FirefoxDriver();
    driver.get("file://C:/DragAndDrop.html");
    WebElement src = driver.findElement(By.id("draggable"));
    WebElement trgt = driver.findElement(By.id("droppable"));

    Actions builder = new Actions(driver);
    builder.dragAndDrop(src, trgt).perform();
  }
コード例 #3
0
 public static void main(String... args) {
   WebDriver driver = new FirefoxDriver();
   driver.get(
       "file:///home/daz/Downloads/WebDriver/8850OS_Code/Chapter%202/HTML/DragAndDrop.html");
   WebElement src = driver.findElement(By.id("draggable"));
   WebElement trgt = driver.findElement(By.id("droppable"));
   Actions builder = new Actions(driver);
   builder.dragAndDrop(src, trgt).perform();
 }
コード例 #4
0
  /** @param model Not tested */
  public void DragAndDrop(MethodParameters model) {
    String[] actType = model.getActionType().split("$");

    WebElement sourceElement = WebDriverClass.getDriver().findElement(By.xpath(actType[0]));
    WebElement destinationElement = WebDriverClass.getDriver().findElement(By.xpath(actType[1]));

    Actions action = new Actions(WebDriverClass.getDriver());
    action.dragAndDrop(sourceElement, destinationElement).build().perform();
  }
コード例 #5
0
 protected void scrollbarVerticalDownScroll() {
   JavascriptExecutor js = (JavascriptExecutor) driver;
   js.executeScript("javascript:window.scrollBy(250,700)");
   WebElement pickerScroll = driver.findElement(By.className("jspDrag"));
   WebElement pickerScrollCorner = driver.findElement(By.className("jspCorner"));
   Actions builder = new Actions(driver);
   Actions movePicker = builder.dragAndDrop(pickerScroll, pickerScrollCorner); // pickerscroll
   // is
   // the
   // webelement
   movePicker.perform();
 }
コード例 #6
0
 protected void scrollbarHorizontalRightScroll() {
   JavascriptExecutor js = (JavascriptExecutor) driver;
   js.executeScript("javascript:window.scrollBy(250,700)");
   WebElement pickerScroll =
       driver.findElement(
           By.xpath("//div[@id='gview_queryStatisticsList']/div[3]/div/div[3]/div[2]/div"));
   WebElement pickerScrollCorner = driver.findElement(By.className("jspCorner"));
   Actions builder = new Actions(driver);
   Actions movePicker = builder.dragAndDrop(pickerScroll, pickerScrollCorner); // pickerscroll
   // is
   // the
   // webelement
   movePicker.perform();
 }
コード例 #7
0
  /** @param args */
  public static void main(String[] args) {
    // FirefoxProfile profile = new FirefoxProfile();
    // profile.setEnableNativeEvents(true);
    // WebDriver driver = new FirefoxDriver(profile);

    System.setProperty(
        "webdriver.chrome.driver", System.getProperty("user.dir") + "\\chromedriver.exe");
    WebDriver driver = new ChromeDriver();

    driver.get("http://jqueryui.com/demos/droppable/");
    Actions act = new Actions(driver);

    WebElement src = driver.findElement(By.xpath("//*[@id='draggable']"));
    WebElement dest = driver.findElement(By.xpath("//*[@id='droppable']"));

    act.dragAndDrop(src, dest).build().perform();

    System.out.println(driver.findElement(By.xpath("//*[@id='droppable']/p")).getText());
  }
コード例 #8
0
  @Override
  public void dragAndDropToObject(
      String locatorOfObjectToBeDragged, String locatorOfDragDestinationObject) {

    WebElement objectToBeDraggedWebElement = getWebElement(locatorOfObjectToBeDragged);

    WrapsDriver wrapsDriver = (WrapsDriver) objectToBeDraggedWebElement;

    WebDriver webDriver = wrapsDriver.getWrappedDriver();

    Actions actions = new Actions(webDriver);

    WebElement dragDestinationObjectWebElement = getWebElement(locatorOfDragDestinationObject);

    actions.dragAndDrop(objectToBeDraggedWebElement, dragDestinationObjectWebElement);

    Action action = actions.build();

    action.perform();
  }
コード例 #9
0
ファイル: UGElement.java プロジェクト: uiguard/uiguard
 @Override
 public IUGElement dragAndDrop(UGElement targetElement) {
   builder.dragAndDrop(element, targetElement.getNativeWebElement()).build().perform();
   return this;
 }
コード例 #10
0
 public void dragAndDropColumn() {
   Actions action = new Actions(driver);
   action.dragAndDrop(find_element(columnA), find_element(columnB)).build().perform();
 }