# Unable to swipe on iOS Simulator using JS

**URL:** <https://discuss.appium.io/t/unable-to-swipe-on-ios-simulator-using-js/22173>\
**Category:** Support\
**Created:** [May 23, 2018, 10:22am UTC](https://discuss.appium.io/t/unable-to-swipe-on-ios-simulator-using-js/22173 "2018-05-23T10:22:54Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![simongilmurray](https://discuss.appium.io/letter_avatar_proxy/v4/letter/s/8e7dd6/32.png) [@simongilmurray](https://discuss.appium.io/u/simongilmurray)\
**Post date:** [May 23, 2018, 10:22am UTC](https://discuss.appium.io/t/unable-to-swipe-on-ios-simulator-using-js/22173/1 "2018-05-23T10:22:54Z")

</div>

I am currently unable to swipe on an iOS simulator (iPhone 8, 11.3). I initially used Appium desktop v1.8.0 (JS) to record which provided me with TouchAction code:

.touchAction([  
{action: ‘press’, x: 306, y: 332},  
{action: ‘moveTo’, x: -233, y: 3},  
‘release’  
])

This didn’t appear to do anything. When I looked at the actual coordinates, it seemed very wrong that it was moving to minus, so I updated it manually:

.touchAction([  
{action: ‘press’, x: 320, y: 350},  
{action: ‘moveTo’, x: 80, y: 350},  
‘release’  
])

This also is doing nothing.

I have tried implementing waitforexists and a pause prior to execution of this.

I have tried using swipe and swipeLeft commands which don’t seem to work and also say they are being deprecated (even tried referencing an element beforehand and even XPath which I know is not recommended):  
i.e:  
.element("~img\_icon\_bag")  
&  
.swipe(’//XCUIElementTypeApplication[@name=“xxx”]/XCUIElementTypeWindow[1]’, -200, 0, 2)  
.swipeLeft(’//XCUIElementTypeApplication[@name=“xxx”]/XCUIElementTypeWindow[1]’, 2)

Below is my headers:

const wdio = require(‘webdriverio’);  
const caps = {“platformName”:“iOS”,“platformVersion”:“11.3”,“deviceName”:“iPhone 8”,“app”:"/Users/xxx/Library/Developer/Xcode/DerivedData/xxx-hlggtgxwuwcrdofzomwyfksiintx/Build/Products/Developer-iphonesimulator/xxx.app",“automationName”:“XCUITest”};  
const driver = wdio.remote({  
protocol: “http”,  
host: “localhost”,  
port: 4723,  
path: “/wd/hub”,  
desiredCapabilities: caps  
});

Running the file via terminal:  
node test.js  
I am not sure what else to try…I read somewhere that it is unable to swipe in a Simulator, but surely that can’t be right?

Appreciate any help!

---

<div class="post-metadata">

**Author:** ![bennid](https://discuss.appium.io/user_avatar/discuss.appium.io/bennid/32/3145_2.png) [@bennid](https://discuss.appium.io/u/bennid)\
**Post date:** [May 23, 2018, 5:03pm UTC](https://discuss.appium.io/t/unable-to-swipe-on-ios-simulator-using-js/22173/2 "2018-05-23T17:03:33Z")

</div>

Are you stuck in a WebView? The other option is to insert a wait between your two actions in your touchAction

---

<div class="post-metadata">

**Author:** ![simongilmurray](https://discuss.appium.io/letter_avatar_proxy/v4/letter/s/8e7dd6/32.png) [@simongilmurray](https://discuss.appium.io/u/simongilmurray)\
**Post date:** [May 24, 2018, 7:54am UTC](https://discuss.appium.io/t/unable-to-swipe-on-ios-simulator-using-js/22173/3 "2018-05-24T07:54:56Z")

</div>

Nope, there’s an initial loading screen with a spinner which then moves on to a native page where you can either swipe three times to access a Login/Register page or press a Skip button.

---

<div class="post-metadata">

**Author:** ![bennid](https://discuss.appium.io/user_avatar/discuss.appium.io/bennid/32/3145_2.png) [@bennid](https://discuss.appium.io/u/bennid)\
**Post date:** [May 24, 2018, 1:11pm UTC](https://discuss.appium.io/t/unable-to-swipe-on-ios-simulator-using-js/22173/4 "2018-05-24T13:11:20Z")

</div>

Did you try putting a wait action in between your press and moveTo?

---

<div class="post-metadata">

**Author:** ![simongilmurray](https://discuss.appium.io/letter_avatar_proxy/v4/letter/s/8e7dd6/32.png) [@simongilmurray](https://discuss.appium.io/u/simongilmurray)\
**Post date:** [May 24, 2018, 2:55pm UTC](https://discuss.appium.io/t/unable-to-swipe-on-ios-simulator-using-js/22173/5 "2018-05-24T14:55:34Z")

</div>

Sorry how would that look?

I’ve tried various different ways of implementing it with no luck, e.g.

.touchAction([  
{action: ‘press’, x: 320, y: 350},  
‘wait’,  
{action: ‘moveTo’, x: 80, y: 350},  
‘release’  
])

&

{action: ‘wait’, 3000),

---

<div class="post-metadata">

**Author:** ![bennid](https://discuss.appium.io/user_avatar/discuss.appium.io/bennid/32/3145_2.png) [@bennid](https://discuss.appium.io/u/bennid)\
**Post date:** [May 24, 2018, 5:16pm UTC](https://discuss.appium.io/t/unable-to-swipe-on-ios-simulator-using-js/22173/6 "2018-05-24T17:16:29Z")

</div>

The raw appium log shows this (all my tests are java, so not sure entirely):

`2018-05-24 16:17:49:321 - [debug] [MJSONWP] Calling AppiumDriver.performTouch() with args: [[{"action":"press","options":{"x":540,"y":1255}},{"action":"wait","options":{"ms":500}},{"action":"moveTo","options":{"x":540,"y":538}},{"action":"release","options":{}}],"60168963-277b-42f7-ac7a-ae9e0e24acb7"]`

So maybe try:

```
.touchAction([
{action: ‘press’, x: 320, y: 350},
{action: ‘wait’, ms: 3000},
{action: ‘moveTo’, x: 80, y: 350},
‘release’
])
```

---

<div class="post-metadata">

**Author:** ![simongilmurray](https://discuss.appium.io/letter_avatar_proxy/v4/letter/s/8e7dd6/32.png) [@simongilmurray](https://discuss.appium.io/u/simongilmurray)\
**Post date:** [May 28, 2018, 9:54am UTC](https://discuss.appium.io/t/unable-to-swipe-on-ios-simulator-using-js/22173/7 "2018-05-28T09:54:12Z")

</div>

Awesome, that worked! Thanks very much for your help!

---

<div class="post-metadata">

**Author:** ![\_NULL](https://discuss.appium.io/user_avatar/discuss.appium.io/_null/32/10011_2.png) [@\_NULL](https://discuss.appium.io/u/_NULL)\
**Post date:** [May 2, 2022, 1:21pm UTC](https://discuss.appium.io/t/unable-to-swipe-on-ios-simulator-using-js/22173/8 "2022-05-02T13:21:18Z")

</div>

Perfectly! You helped me a lot! Action - “wait” solved my problem!
