Skip to content

Commit 814e011

Browse files
LEFT and RIGHT confusion was worked out
1 parent a68ad44 commit 814e011

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/main/java/io/appium/java_client/SwipeElementDirection.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ void swipe(AppiumDriver driver, MobileElement element, int duration){
3737
Point p = element.getCenter();
3838
Point location = element.getLocation();
3939
Dimension size = element.getSize();
40-
driver.swipe(location.getX(), p.getY(), location.getX() + size.getWidth(), p.getY(), duration);
40+
driver.swipe(location.getX() + size.getWidth(), p.getY(), location.getX(), p.getY(), duration);
4141
}
4242
},
4343
/**
@@ -49,7 +49,7 @@ void swipe(AppiumDriver driver, MobileElement element, int duration){
4949
Point p = element.getCenter();
5050
Point location = element.getLocation();
5151
Dimension size = element.getSize();
52-
driver.swipe(location.getX() + size.getWidth(), p.getY(), location.getX(), p.getY(), duration);
52+
driver.swipe(location.getX(), p.getY(), location.getX()+ size.getWidth(), p.getY(), duration);
5353
}
5454
};
5555

src/test/java/io/appium/java_client/android/AndroidGestureTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,11 @@ public void elementGestureTest(){
108108
e2.swipe(2000);
109109
e2.swipe(SwipeElementDirection.UP,2000);
110110
e2.swipe(SwipeElementDirection.DOWN,2000);
111-
e2.swipe(SwipeElementDirection.LEFT,100);
111+
e2.swipe(SwipeElementDirection.RIGHT,1000);
112112
MobileElement e3 = (MobileElement) driver.findElement(MobileBy.AccessibilityId("Custom Title"));
113-
e3.swipe(SwipeElementDirection.LEFT,100);
113+
e3.swipe(SwipeElementDirection.RIGHT,1000);
114114
MobileElement e4 = (MobileElement) driver.findElement(MobileBy.AccessibilityId("Change Left"));
115115
e4.pinch();
116-
e4.swipe(SwipeElementDirection.RIGHT,100);
116+
e4.swipe(SwipeElementDirection.LEFT,2000);
117117
}
118118
}

0 commit comments

Comments
 (0)