Left to Right Swipe doesn't work for me (Android Appium: Using Ruby Cucumber)


#1

Hello there! I am new to appium(Ruby Cucumber for Android) using Appium v1.7.1 on a Nexus 5(OS 5.1) and I can’t get my code to swipe from the Left to the right to work using percents.

ie

Appium::TouchAction.new.swipe(start_x: 0.1, start_y: 0.5, offset_x: 0.99, offset_y: 0.5, duration:1000).perform

but

Appium::TouchAction.new.swipe(start_x: 10, start_y: 0.5, offset_x: 900, offset_y: 0.5, duration:1000).perform

works. Which is problematic because if I try to test on a device with a smaller screen it goes off screen and the step fails. Any help would be greatly appreciated!


#2

Have you thought about getting the screen size and adjusting your start_x accordingly?


#3

That would definitely be a good way around the issue. Thank you!

It just deeply bothers me that, that fails but my right to left works using this:

Appium::TouchAction.new.swipe(start_x: 0.90 , start_y: 0.5, offset_x: 0.5, offset_y: 0.5, duration:3500).perform

PS: Ignore the stupid long duration, one of the tablets I test on requires this for it to not skip pages.


#4

Window size worked great and I am now calculating my percents! thanks!


#5


#6

Hi Jessie,

Can you share with me how i can use the window_size in this case?