Problem Swipe with Appium 1.6.3 [iOS 10]

Hi !

I’m using:
macOS Sierra 10.12
iPhone (real device) with iOS 10.1
Xcode 8.1
Appium 1.6.3

I’m using method ‘Swipe’ with:

driver.swipe(400, 50, 900, 50)

but it is not worked for me.
I try with:

driver.swipe(400, 50, -900, 50)

It’ s worked but result is two swipe from left to right (expected result is one swipe)

The swipe method needs 5 parameters:
driver.swipe(start_x, start_y, end_x, end_y, duration)

you can also use:
elem.swipe(SwipeElementDirection.LEFT, 600)

But watch out, driver.swipe is going to be deprecated with java client 5.
Maybe you should go for TouchActions:
driver.performTouchAction(new IOSTouchAction(driver).press(elem)
.moveTo(0, elem.getLocation().getY())
.release());

1 Like

@derunewige Thank you for help me.
I saw this link https://github.com/appium/python-client/blob/master/appium/webdriver/webdriver.py#L242 and I have read not work with Selenium 3.
Your commands are for Java. Is it possible receive this in Python? Thank you

sry, I have no plan of the exact python code.
I just had a short look here: appium-bindings

Maybe this link could also be helpful for you: #issues-bugs137

Thank you for help me.
I have tried to execute with TouchAction but the swipe is performed twice [Python]:

touch_action = TouchAction(driver)
touch_action.press(element_found, 0, 452).wait(1000).move_to(element_found, 691, 452).release().perform()

@antoios

I am facing some different issue however i believe you can help me out.

I am using quite similar configuration you have
Xcode - 8.2
Appium -1.4
Mac - 10.11
Iphone - 10 +

When i am try the open appium inspector, I am getting pop up window

And below is the error

info: [debug] Removing any remaining instruments sockets
info: [debug] Cleaned up instruments socket /tmp/instruments_sock
info: [debug] Auto-detecting iOS udid…
info: [debug] Not auto-detecting udid, running on sim
info: [debug] Could not parse plist file (as binary) at /Applications/Appium.app/Contents/Resources/node_modules/appium/com.hive.automation/en.lproj/Localizable.strings
info: Will try to parse the plist file as XML
info: [debug] Could not parse plist file (as XML) at /Applications/Appium.app/Contents/Resources/node_modules/appium/com.hive.automation/en.lproj/Localizable.strings
warn: Could not parse app Localizable.strings assuming it doesn’t exist
info: [debug] Creating instruments
info: [debug] Preparing uiauto bootstrap
info: [debug] Dynamic bootstrap dir: /Users/hitesh.sharma/Library/Application Support/appium/bootstrap
info: [debug] Dynamic env: {“nodePath”:"/Applications/Appium.app/Contents/Resources/node/bin/node",“commandProxyClientPath”:"/Applications/Appium.app/Contents/Resources/node_modules/appium/submodules/appium-uiauto/bin/command-proxy-client.js",“instrumentsSock”:"/tmp/instruments_sock",“interKeyDelay”:null,“justLoopInfinitely”:false,“autoAcceptAlerts”:false,“autoDismissAlerts”:false,“sendKeyStrategy”:“grouped”}

info: [debug] Dynamic bootstrap code: // This file is automatically generated. Do not manually modify!

info: [debug] Dynamic bootstrap path: /Users/hitesh.sharma/Library/Application Support/appium/bootstrap/bootstrap-5923cadea0343e3f.js

info: [debug] Reusing dynamic bootstrap: /Users/hitesh.sharma/Library/Application Support/appium/bootstrap/bootstrap-5923cadea0343e3f.js
info: [debug] Attempting iOS device log capture via libimobiledevice idevicesyslog

info: [debug] Creating iDevice object with udid b51c61f33dd303b1207d599be1223340debb10a6

info: [debug] App is not installed. Will try to install the app.

info: [debug] Cleaning up appium session

error: Failed to start an Appium session, err was: Error: Installing com.hive.automation failed

info: [debug] Error: Installing com.hive.automation failed
at /Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/node-idevice/main.js:159:6
at ChildProcess.exithandler (child_process.js:742:7)
at ChildProcess.emit (events.js:110:17)
at maybeClose (child_process.js:1015:16)
at Process.ChildProcess._handle.onexit (child_process.js:1087:5)

info: [debug] Responding to client with error: {“status”:33,“value”:{“message”:“A new session could not be created. (Original error: Installing com.hive.automation failed)”,“origValue”:“Installing com.hive.automation failed”},“sessionId”:null}
info: <-- POST /wd/hub/session 500 1139.158 ms - 196

Do you have any pointer please ?

Your version of Appium 1.4 is not compatible with xcode 8. You need to upgrade to Appium 1.6 if you will be using xcode 8. Otherwise, stick with Appium 1.5.3 and Xcode 7.3.

Hi,

I used elem.swipe(SwipeElementDirection.LEFT, 600) but it seems Appium 1.6.3 has problem with swipe in general because when I say .LEFT it scrolles down.
swipe needs a review.

You are having issues with the inspector, so this is a different problem.

Please open a new issue

The following is working fine using Javascript with wd and wd-bridge with Appium 1.6.3 on iPhone 7 running iOS 10.2:

var iosSwipe = function (opts) {
    var action = new wd.TouchAction();
    var dx = opts.endX - opts.startX;
    var dy = opts.endY - opts.startY;
    action
        .press({x: opts.startX, y: opts.startY})
        .wait(opts.duration)
        .moveTo({x: dx, y: dy})
        .release();

    action.driver = wdBrowser;
    return wdBrowser.performTouchAction(action);
};

e.g. left swipe

iosSwipe({
    startX: 400,
    startY: 100,
    endX: 50,
    endY: 100,
    duration: 500
});
1 Like

Thank you! After much searching and experimentation, this is the only solution I’ve found that works for me.

Appium - Python scroll to an element in page:
el = self.driver.find_element_by_id(‘Logout’)
self.driver.execute_script(‘mobile: scroll’, {“element”: el, “toVisible”: True})

1 Like

Maybe someone is using Python to perform swipe up on iOS10? :slight_smile:

I am struggling with double tap on real device - double tap works for me only on emulator and swipe up, on both real device and emulator with iOS 10.3.

Can anyone help me with this?

   start_x = size["width"] * 0.5
    start_y = size["height"]
    end_x = size["width"] * 0.5
    end_y = size["height"] * 0.5

action.press(el, start_x, start_y).wait(1000).move_to(el, end_x, end_y).release().perform()

I want to swipe up to show control center and turn on flight mode on iOS. I already tried a lot of combinations and other methods like:

   self.driver.swipe(start_x=0, start_y=start_y, end_x=0, end_y=-20, duration=1000)
   self.driver.flick(start_x=100, start_y=height_max, end_x=100, end_y=200)

I am using Mac OS 10.12 with Appium 1.6.5 and newest Python client 0.24.

**OK I GOT THIS xD - the wait was a problem, when I changed it from 1000 do 100 it worked :slight_smile:

action.press(el, start_x, start_y).wait(100).move_to(el, end_x, end_y).release().perform()

**