I was able to make swipe work in few cases. But have problems with swiping about 70 percent…
My screen has 320 px width
The code that works for me in first case is:
x_offset= -130
y = 211 # note relevant
$ios_driver.swipe :start_x => x, :start_y => y, :end_x => x_offset, :end_y => 0
This only swipes the element for about 40% of the screen. Now I want to swipe to about 70%, so when I try
x_offset= -180
$ios_driver.swipe :start_x => x, :start_y => y, :end_x => x_offset, :end_y => 0
I get point out of bound, javascript error. Looking at stack trace the error seems to be coming from webdriver. Strangely enough, appium app(GUI) was able to make this swipe work with the following code.
require 'rubygems'
require 'appium_lib'
capabilities = {
'appium-version': '1.2',
'platformName': 'iOS',
'platformVersion': '7.1',
}
server_url = "http://0.0.0.0:4723/wd/hub"
Appium::Driver.new(caps: capabilities).start_driver
Appium.promote_appium_methods Object
swipe :start_x => 300, :start_y => 301, :end_x => 30, :end_y => 306, :touchCount => 1, :duration => 0.5
driver_quit
This same exact swipe code doesn’t work from my test project(I get duration validation errors and point of bound errors).