Skip to content

Instantly share code, notes, and snippets.

@dpgraham
Created June 7, 2018 20:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dpgraham/8b8584fd725d71561bde9e1ec863b237 to your computer and use it in GitHub Desktop.
Save dpgraham/8b8584fd725d71561bde9e1ec863b237 to your computer and use it in GitHub Desktop.
Appium 1.8.0: moveTo Absolute to Relative Coordinates Change
* Appium 1.8.0 introduced a change to the way the `moveTo` touch events works
* Previously, `moveTo` treats coordinates as relative, now `moveTo` accepts coordinates
(in compliance with the spec)
Example
========================
* Python sample
```python
driver
.press(x1, y1)
.wait()
.move_to(x2, y2)
.release()
```
* Pre Appium 1.8.0
* The `touch` action would press down at absolute coordinates x1, x2
* The `move_to` action moves to the x2, y2 relative to x1, y1 (in absolute terms, it moves to x1 + x2, y1 + y2)
* Appium 1.8.0 and onwards
* The `touch` action would press down at absolute coordinates x1, x2 (same as before)
* The `move_to` action moves to the absolute x2, y2 coordinate
Adapting to Changes
=======================
* If this change broke one of your `moveTo` scripts, the way to fix it is to simply add x1 and y1 to your relative coordinates
* So if your code looked like this before:
```python
driver
.press(x1, y1)
.wait()
.move_to(x2, y2)
.release()
```
* It needs to look like this now:
```python
driver
.press(x1, y1)
.wait()
.move_to(x1 + x2, y1 + y2)
.release()
```
@romansvesh
Copy link

AttributeError: 'Driver' object has no attribute 'press'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment