Пример #1
0
  @Test
  public void testDrapAndDrop() throws PageException {
    try {
      // open w3 schools tutorial
      driverObj.get(prop.getProperty("w3tutorials_url"));
      // driverObj.get("file:///C:/Users/P8-03GPQ0/Desktop/Drag_Drop.html");
      Thread.sleep(2000);

      // find draggable element
      // ITafElement draggable = webpage.findObjectByxPath(".//*[@id='drag1']");
      ITafElement draggable =
          webpage.findObjectById(prop.getProperty("w3tutorials_draggable_text"));

      Point point1 = draggable.getCoordinates();

      // find the drop area
      ITafElement dropArea = webpage.findObjectById(prop.getProperty("w3tutorials_drop_area"));

      // drag and drop the text
      draggable.dragAndDrop(dropArea);

      Point point2 = draggable.getCoordinates();

      Assert.assertNotEquals(point1.getY(), point2.getY());
    } catch (Exception ex) {
      ex.printStackTrace();
    }
  }