Drag & Drop Hello World Example

Hi again :slight_smile:

Thanks @jonahss your example helped me to debug the functionality. I have now made it work but I have made a few discoveries.

  1. When you use getLocation(WebElement), the result is in reference to the web page itself.
  2. When you perform TouchActions (like press and move) they are in reference to the screen. (quite unexpected, but unfortuantely it is WAP (work as planned)).
  3. BUG : In the documentation for the moveTo method (Both 1.7 & 2.0), we state Move current touch to an absolute position on the screen. However this is incorrect! We actually move the move to a point in reference to the original point.
  4. BUG ? : These actions do not work on a real device :frowning:

Example (using code from the Jonahโ€™s example using Java). In this example we draw a horizontal line:

URL url = new URL("http://10.131.151.227:4723/wd/hub");
AppiumDriver driver = new AppiumDriver(url, capabilities);
driver.get("http://lukasolson.github.io/multi-touch-draw/");
action.press(100,100).moveTo(163, 0).release().perform();

The line below creates a vertical line that is 100px long:

 action.press(100,100).moveTo(0, 100).release().perform();
1 Like