# UITouch with force/pressure

**URL:** <https://discuss.appium.io/t/uitouch-with-force-pressure/30470>\
**Category:** Issues/Bugs\
**Created:** [April 25, 2020, 8:15pm UTC](https://discuss.appium.io/t/uitouch-with-force-pressure/30470 "2020-04-25T20:15:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bjanzen](https://discuss.appium.io/user_avatar/discuss.appium.io/bjanzen/32/7019_2.png) [@bjanzen](https://discuss.appium.io/u/bjanzen)\
**Post date:** [April 25, 2020, 8:15pm UTC](https://discuss.appium.io/t/uitouch-with-force-pressure/30470/1 "2020-04-25T20:15:48Z")

</div>

On both simulator and real device, I cannot get a TouchAction to register. We require a touch via Pencil where force \> 1 for certain actions. In python, I do

TouchAction(driver).press(None, 500, 500, pressure=2.0).perform()

It appears to work, but nothing happens on iPad (simulator or device). Looking at logs, all seems normal:

[HTTP] --\> POST /wd/hub/session/91e35fab-d162-4ed6-847a-06c55d46668f/touch/perform  
[HTTP] {“actions”:[{“action”:“press”,“options”:{“x”:500,“y”:500,“pressure”:2}}]}

[debug] [W3C (91e35fab)] Calling AppiumDriver.performTouch() with args: [[{“action”:“press”,“options”:{“x”:500,“y”:500,“pressure”:2}}],“91e35fab-d162-4ed6-847a-06c55d46668f”]  
[debug] [XCUITest] Executing command ‘performTouch’  
[debug] [XCUITest] Received the following touch action: press(options={“x”:500,“y”:500,“pressure”:2})  
[debug] [WD Proxy] Proxying [POST /wda/touch/perform] to [POST [http://127.0.0.1:8100/session/6465DD50-0431-4511-AE72-8F54D1C10910/wda/touch/perform](http://127.0.0.1:8100/session/6465DD50-0431-4511-AE72-8F54D1C10910/wda/touch/perform)] with body: {“actions”:[{“action”:“press”,“options”:{“x”:500,“y”:500,“pressure”:2}}]}  
[debug] [WD Proxy] Got response with status 200: {“value”:null,“sessionId”:“6465DD50-0431-4511-AE72-8F54D1C10910”}  
[debug] [W3C (91e35fab)] Responding to client with driver.performTouch() result: null

[HTTP] \<-- POST /wd/hub/session/91e35fab-d162-4ed6-847a-06c55d46668f/touch/perform 200 150 ms - 14

Any ideas? [3D Touch in IOS](https://discuss.appium.io/t/3d-touch-in-ios/27018) did not provide clues, because iPads don’t do 3D Touch and it’s being phased out of phones and iOS in general, correct?

---

<div class="post-metadata">

**Author:** ![mykola-mokhnach](https://discuss.appium.io/user_avatar/discuss.appium.io/mykola-mokhnach/32/4578_2.png) [@mykola-mokhnach](https://discuss.appium.io/u/mykola-mokhnach)\
**Post date:** [April 26, 2020, 7:33am UTC](https://discuss.appium.io/t/uitouch-with-force-pressure/30470/2 "2020-04-26T07:33:04Z")

</div>

> [@bjanzen](#):
>
> {“actions”:[{“action”:“press”,“options”:{“x”:500,“y”:500,“pressure”:2}}]}

XCTest is known to ignore such actions. It needs at least a pause and a release action to be performed after press

---

<div class="post-metadata">

**Author:** ![bjanzen](https://discuss.appium.io/user_avatar/discuss.appium.io/bjanzen/32/7019_2.png) [@bjanzen](https://discuss.appium.io/u/bjanzen)\
**Post date:** [April 26, 2020, 11:39pm UTC](https://discuss.appium.io/t/uitouch-with-force-pressure/30470/3 "2020-04-26T23:39:57Z")

</div>

Yea, my ObjC skills are rusty, but I found the Category that’s imported:  
appium/node\_modules/appium-webdriveragent/WebDriverAgentLib/Categories/XCUIElement+FBForceTouch.m

It has a  
@“action”: @“wait”,  
@“options”: @{  
@“ms”: @(duration \* 1000)

which I changed to larger values, but Appium returns the 200 immediately with no wait, so clearly you’re correct. Reading [https://developer.apple.com/documentation/uikit/uitouch/1618110-force](https://developer.apple.com/documentation/uikit/uitouch/1618110-force) I may also have to worry about Pencil’s altitudeAngle? My ObjC skills are rusty though, but I’ll continue to fiddle with this for a solution.
