Created
June 7, 2018 20:45
-
-
Save dpgraham/8b8584fd725d71561bde9e1ec863b237 to your computer and use it in GitHub Desktop.
Appium 1.8.0: moveTo Absolute to Relative Coordinates Change
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* 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() | |
``` | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
AttributeError: 'Driver' object has no attribute 'press'