iOS 8 swipe / scrollTo

Question 1: is anybody getting swipe to work in iOS 8, ruby or javascript?

Question 2: has anyone else seen that you cannot find an element that isn’t visible but could be scrolled into view?


I’m just now trying to swipe with the beta for appium 1.3 and having no luck. My developers want me to dump Appium for iOS testing and I’m trying to keep it alive. Android testing works great, not perfect but I like it. Before we went to Xcode 5 I was able to write one set of tests that ran on both platforms. Perhaps I’m just doing it wrong:

def swipe_to_the_left
  if ios?
    browser.execute_script 'mobile: swipe', startX: 310, startY: 150, endX: 10, endY: 155, duration: 0.5
    browser.execute_script 'mobile: swipe', startX: 0.9, startY: 0.3, endX: 0.1, endY: 0.27, duration: 0.5

My Xcode is 6.1 GM2

hi @brentlavelle,

I know this thread is old but I am curious that if you find a way to make swipe gesture work. It seems like this only works for real device but not for simulator

I have a workaround of using AppleScript to calculate the location of the Simulator and then try to drag the mouse from there. Currently this solution can solve the problem but only on local hub, I think this will be broken if we run the test on remote hub like SauceLab

We made some swipe-related fixes in the 1.3.2-Beta. You might want to check it out. Details are pinned in the main forum.

I’ve been having less and less luck with iOS and Appium since Xcode 5. This week I’ve tried to get it running on an iPad running iOS 8.1 but that doesn’t work for me too. Another issue is element.displayed? lies so I now have 0 running tests and I’m getting pressure to switch tools. Instruments/UI-Automation doesn’t seem to work well so I’m looking at KIF now. It is sad, last year at this time I had iOS and Android tests running from the same source.

@0x1mason, I don’t think update to 1.3.2 can fix the problem because I got no luck even if I run the script directly on instrument ( using dragFromToForDuration function). But I’ll give it a try and will let you know the result

@brentlavelle, i am sorry to hear that you have to switch to KIF. I don’t know why you got trouble with element.displayed because I am using it and it works just fine. Anyways, good luck with your decision!

@tbao @brentlavelle mobile: swipe is deprecated in Appium, though it may work in some cases. Most of the clients now have swipe convenience methods.

Here’s Ruby swipe:

Also, there are a couple extra steps required for configuring iOS8.1 simulators. Please walk through the system setup here:

I’ll have to look into isDisplayed. If you have a repro case, please post it on our GitHub site.

I’ve set up the 8.1 simulators as described but I did not know about

I tried this but it isn’t working

def ios_swipe_left
  action =
  action.swipe start_x: 200, end_x: 30, start_y: 50, end_y: 55, duration: 400

The elements that always .displayed? are in the slide out menu and apparently they are always out just covered by other screens when you seem to slide them out of site.

My biggest problem is that I can’t figure out how to get to elements. I have no problem doing this with Android using the uiautomationviewer and I can find_element by :id . This will be a problem with any framework I end up using for iOS, not being able to figure out what is in the dom and not able to use ids.

I found one issue at assumes I have a global $driver set. I tried to set this global to the variable I get from Selenium::WebDriver.for(:remote, :desired_capabilities => capabilities, :url => server_url) but touch_actions is not a method.

This applies to Android using Appium v1.3.2-beta2
In that version the following execute_script no longer works so I need the downgrade appium the server

  driver.execute_script 'mobile: swipe', startX: 0.9, startY: 0.3, endX: 0.1, endY: 0.27, duration: 0.5

This execute script now throws

Selenium::WebDriver::Error::UnknownError: Not yet implemented. Please help us:

@bootstraponline Any thoughts on this?

‘mobile: swipe’ is deprecated, but bootstraponline may have some info on the ruby part.


I tried this but it isn’t working

Can you try setting the duration to 500? I have a vague memory of 500ms being the min allowed.

Why are we still supporting mobile methods? I’m pretty sure TouchActions are the desired approach.

If you have a driver using ruby_lib, then the global driver will be set by default. The tests that were pointed out work.

You need to use the appium ruby console. It’s very easy to test out the touch actions such as swipe in a REPL. The page command will list the elements.

I recommend reading the bootcamp guide.

@0x1mason, I updated to Appium 1.3.3 and I still cannot use swipe gesture.

Should the problem be the same as I know this was for ios7 but I am not sure if it is fixed for ios8

This helps. I was still doing this:

   driver = Selenium::WebDriver.for(:remote, :desired_capabilities => capabilities, :url => '')

instead of

driver = something

I’ll try that out tomorrow.

No dice, Here is the code, the button press happens but the gesture doesn’t. I’ve tried on a number of os versions an the 5s and 6 simulators

require 'appium_lib'

capabilities = {
    deviceName:        'iPhone 5s',
    platformVersion:   '7.1',
    app:               '/Users/blavelle/',
    platformName:      :ios,
    newCommandTimeout: 0,
appium = capabilities)
driver = appium.start_driver

driver.find_element(:name, 'welcome_travelerButton').click

appium.swipe(start_x: 300, end_x: 30, start_y: 50, end_y: 55, duration: 900).perform
appium.swipe(start_x: 0.95, end_x: 0.1, start_y: 0.2, end_y: 0.22, duration: 700).perform

It takes a little while for the 2 swipe attempts to not swipe the screen. I noticed that if I perform the action while the swipes are going on I’ll see something happen but not what I want to happen.

Hi Friends, Happy to see new appium version 1.3.4, So I run few testing on new appium version.

Bugs found : ‘Swipe’ gesture does not work on iOS 8.1 And Xcode 6.1.
Methods used
appium.swipe :start_x => 97, :start_y => 521, :end_x => 229, :end_y => 521, :touchCount => 1, :duration => 500
mobile.swipe :start_x => 97, :start_y => 521, :end_x => 229, :end_y => 521, :touchCount => 1, :duration => 500
driver.swipe :start_x => 97, :start_y => 521, :end_x => 229, :end_y => 521, :touchCount => 1, :duration => 500

Seems like this topic is similar: Swipe broken on 1.3.3? ios 8.1

Apple broke gestures on the iOS simulator a long time ago and never fixed them. It’s not specific to appium.

Hi Swipe also dosent work for me any idea when this will be fixd